I am seeing the runtime error message “1004” [duplicate]
问题 This question already has answers here : Run-Time error 1004 Excel 2013 (2 answers) Closed 3 years ago . I am seeing "Run-time Error 1004" at lastrow = Sheet1.Cells(Rows.Count, 1).End(x1Up).Row in my code: Sub copycolumns() Dim lastrow As Long, erow As Long lastrow = Sheet1.Cells(Rows.Count, 1).End(x1Up).Row For i = 2 To lastrow If Sheet1.Cells(i, 6) = "Algiers" Then Sheet1.Cells(i, 1).Copy erow = Sheet2.Cells(Rows.Count, 1).End(x1Up).Offset(1, 0).Row Sheet1.Paste Destination:=Worksheets(