+ Reply to Thread
Results 1 to 2 of 2

Export several sheets to number of different workbooks

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    33

    Export several sheets to number of different workbooks

    Hi Guys,

    Little bit of a problem here and I hope you guys can help me out. I've written the macro below that will do the following.
    *select all the sheets in the workbook
    *copy all the sheets to a new workbook
    * depending on the RegName it will delete certain rows.
    * Save the workbook

    What I'm asking for is a better solution then writing the Do until ("sheet1") loop for every sheet that I want i to do and instead just have one string of code

    Secondly instead of writing out the whole array that is should go through is there a shorter way of writing all of the sheet names (approx 30 Ws in my Wb) or just make it go from sheet1 until the last sheet if the amount should vary?



    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-19-2010
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2016
    Posts
    48

    Re: Export several sheets to number of different workbooks

    I don't fully understand what you are trying to do with RegName, and the code you posted has multiple issues like undeclared variables, but if I was going to loop through sheets this is what I would do:

    Please Login or Register  to view this content.

    I added a "worksheets.activate" and a "stop" so you can see what it is doing but you could put anything inside that "With" statement and have it executed on each sheet.

    Hope this helps.
    Last edited by pichon; 04-14-2011 at 12:16 PM.

+ 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