+ Reply to Thread
Results 1 to 8 of 8

Excel Run time Error 1004: Copy method of Worksheet Class failed

  1. #1
    Registered User
    Join Date
    01-07-2008
    Location
    Northampton, UK
    MS-Off Ver
    version 2212, office 365 enterprise
    Posts
    74

    Excel Run time Error 1004: Copy method of Worksheet Class failed

    I've spent all day writing code to copy a worksheet and manipulate data. I have just finish writing the code to get data from other sources. Now when I run the macros all together, the part of the code that copies the existing sheet fails. and I get the error code '1004'

    Here is the code I'm using:

    Please Login or Register  to view this content.
    The individual macros (NewPPGDaten...) work fine on their own, its the first line: Sheets("PPG Daten").Copy After:=Sheets(9) thats giving me difficulty.

    Any ideas?

  2. #2
    Registered User
    Join Date
    01-07-2008
    Location
    Northampton, UK
    MS-Off Ver
    version 2212, office 365 enterprise
    Posts
    74
    *bump* anyone?

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello chrismann85,

    The code syntax is correct. The only possible reasons it would fail would be if you have less than 9 worksheets or you named the worksheet the number 9. In the case of the latter, it should appear in quotes - Sheets("9"). Barring these conditions, the problem would have to be elsewhere in your code.

    Sincerely,
    Leith Ross

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Or it could be that annoying bug in Excel that still hasn't been fixed: http://support.microsoft.com/kb/210684.

    The workaround described there is not overly inconvenient.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Why do you have 108 (or is it 109) different subroutines?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Shg,

    Thanks for sharing that article. I have never encountered the problem as described by Microsoft, but thanks to you I am now aware a problem does exist with copying a worksheet.

    Sincerely,
    Leith Ross

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    That link somehow seemed a lot harder to find when I was having the same problem a few years ago, Leith

    I echo Norie's question ...

  8. #8
    Registered User
    Join Date
    01-07-2008
    Location
    Northampton, UK
    MS-Off Ver
    version 2212, office 365 enterprise
    Posts
    74

    Thumbs up Thanks

    Thanks for all the helpful advice, for some reason, when I saved and closed the workbook, and came back to it in the morning it decided to work . Bit confusing but I'm not complaining.

    I do have a lot of subroutines! it was a very confusing code to write, thats why I was so worried when then damn thing didn't run. Each one is similar to the last with minor things changed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1