I'm trying to copy data from several workbooks into another - in Excel 2003. The following code works perfectly except when there is only the header row in the target workbook. Then I get the following error message, "Run time error 1004. Application defined or Object defined error". How can I get it to find A2 the first time - without coding A2 in?
Code:Sheets("All").Range("A1").End(xlDown).Offset(1, 0).Select ActiveSheet.Paste
Thanks for any help
Steve W
Last edited by swallis; 07-23-2009 at 04:24 AM. Reason: Trying to add code tags
Please take a few minutes to read the forum rules, and then edit your post to add code tags.
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
[code]
code goes here
[/code]
and looks like this:
Code:code goes here
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
Eventually found the answer through Google
At least I know how to use tags now....Code:ActiveSheet.Cells(Rows.Count, "a").End(xlUp).Offset(1).Select
Steve W
Good job.
Your use of ActiveSheet is unnecessary though -- the sheet does not need to be selected:
Code:Sheets("All").Cells(Rows.Count, "A").End(xlUp).Offset(1).PasteSpecial
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks