+ Reply to Thread
Results 1 to 5 of 5

Thread: Finding A2

  1. #1
    Registered User
    Join Date
    04-07-2009
    Location
    Tasmania, Australia
    MS-Off Ver
    Excel 2003
    Posts
    15

    Finding A2

    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

  2. #2
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: Finding A2

    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

  3. #3
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: Finding A2

    [code]
    code goes here
    [/code]

    and looks like this:
    Code:
    code goes here
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    04-07-2009
    Location
    Tasmania, Australia
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Finding A2

    Eventually found the answer through Google

    Code:
    ActiveSheet.Cells(Rows.Count, "a").End(xlUp).Offset(1).Select
    At least I know how to use tags now....

    Steve W

  5. #5
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: Finding A2

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0