My purpose is to copy rows from another Excel workbook and paste it back into my original Excel workbook
This code works perfectly well if i remove line 2 and test it on my original Excel workbook that i am working on.
But the moment i add in line 2 to activate another Excel workbook ("Book1"), and when i run the same code, this codes fails at the 3rd line. Error message is "Application-defined or object-defined error". Strangely the first 2 lines works but until the 3rd line it fails. This only happens whenever i try to activate different excel workbook.
I tried to convert the Excel files into same format such as xlsm, xlsx, csv but it still does not work. I tried for hours. Please explain to me what is the error. Thank You
Sub test()
MsgBox ActiveCell.Value
Workbooks("Book1").Activate
Range("a1").End(xlDown).Select ----->>This line is where error occurs
i = ActiveCell.Row
Range(Rows(1), Rows(i)).Copy
End Sub