+ Reply to Thread
Results 1 to 5 of 5

Copying worksheets via VBA causes run-time error 1004

  1. #1
    Registered User
    Join Date
    02-24-2011
    Location
    Brighton, England
    MS-Off Ver
    Excel 2003
    Posts
    19

    Copying worksheets via VBA causes run-time error 1004

    Hi there,

    I am running the following code, original created by Jerry Beaucaire:-

    Please Login or Register  to view this content.
    Due to the number of sheets that I am attempting to copy I get an error 1004. I have found some code at the following link in the 'Resolution' section:- http://support.microsoft.com/kb/210684/en-us

    Does anyone have an idea on how I go about incorporating this into my code?

    The xls file is here-

    http://dl.dropbox.com/u/297575/Excel%20Forum%20Copy.xls

    I look forward to any suggestions.

    Thanks

    Neil

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying worksheets via VBA causes run-time error 1004

    As I think about it, if you have THAT many sheets to copy, I wouldn't do it this way at all. I would create a template file with all these extra sheets in it and the template sheet to fill out already titled INPUT. I would have a macro in a second workbook with the DATA.

    The macro would open the already existing generic template file, fill out the INPUT sheet and save/close with the correct filename, repeat for the next row of data. No copying of sheets...everything already exists in the template file being opened fresh for each iteration of input.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-24-2011
    Location
    Brighton, England
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Copying worksheets via VBA causes run-time error 1004

    Great news Jerry that it would be possible using that method. Do you have any code that I can use as starting point at all? I am a beginner so I am only currently able to tweak code and this is my most ambitious project to date!

    Any help would be appreicated

    Thank you

  4. #4
    Registered User
    Join Date
    02-24-2011
    Location
    Brighton, England
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Copying worksheets via VBA causes run-time error 1004

    I have cracked it with the help of the code herehttp://salesanalyticsusingexcel.blog...-close-99.html

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying worksheets via VBA causes run-time error 1004

    Good work!

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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