The just returns a range. try this to understand what it returns (next available empty cell in column A)
Sub test2()
Dim z As Range
Set z = Sheet2.Range("A" & Sheet2.Rows.Count).End(3)(2) 'OR
Set z = Sheet2.Range("A" & Sheet2.Rows.Count).End(xlUp)(2)
MsgBox z.Address
End Sub
Instead of over complicating the code and making it difficult to remember you can also use this.
Sub test2()
Application.ScreenUpdating = False
With Sheet1.Range("A1").CurrentRegion
.AutoFilter field:=4, Criteria1:="Code"
.Offset(1, 0).EntireRow.Copy Sheet2.Cells(Sheet2.Rows.Count, "A").End(xlUp).Offset(1, 0)
.AutoFilter
End With
Application.ScreenUpdating = True
End Sub