Based on what you mentioned in the post, this is how the code should look like. the code need to
1. Find out how many rows need to compare
2. Loop each row, compare the Z column value in Sheet5 and Sheet1
3. If match, copied the cells A:Y from Sheet5 to Sheet1
Tested on Excel 2016.
Sub CP_CopyPasteRow()
Dim lastrow As Long
Application.DisplayAlerts = False
With Sheets("Sheet5")
lastrow = .Cells(.Rows.Count, "Z").End(xlUp).Row
For r = 1 To lastrow
If Worksheets("Sheet1").Cells(r, Range("Z" & 1).Column).Value = .Cells(r, Range("Z" & 1).Column).Value Then
.Rows(r).Copy
Worksheets("Sheet1").Range("A" & r & ":Y" & r).PasteSpecial xlPasteValues
End If
Next r
End With
Application.DisplayAlerts = True
End Sub