+ Reply to Thread
Results 1 to 4 of 4

Saving each worksheet as a separate file (starting from a particular worksheet)

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    Columbus
    MS-Off Ver
    excel 2010
    Posts
    9

    Saving each worksheet as a separate file (starting from a particular worksheet)

    Hey guys,

    I'm pretty new and would love some input. Essentially I'm looking for a macro that will save each worksheet as a separate workbook. The trick is the number of worksheets will be a variable and I need to start from a particular worksheet. I'm working from a workbook that has the first four sheets as generic summary data info and, beginning on the 5th sheet, individual employee performance data. So, Starting from the first employee sheet to the last, however many there are, I need to save each as a separate file so that it can be sent as an attachment to that employee. I thought maybe filling an array with the worksheets and then referring to each element in the array from 5 to Ubound, and using saveas.....unfortunately im not skilled enough yet to completely hammer this out on my own.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Saving each worksheet as a separate file (starting from a particular worksheet)

    Hi Andrew,

    Try this:
    Please Login or Register  to view this content.
    Lewis
    Last edited by LJMetzger; 07-01-2014 at 04:42 PM. Reason: Removed code due to coding error. Corrected code in post #4.

  3. #3
    Registered User
    Join Date
    01-14-2013
    Location
    Columbus
    MS-Off Ver
    excel 2010
    Posts
    9

    Re: Saving each worksheet as a separate file (starting from a particular worksheet)

    Awesome man thanks! one thing, im gettin a 'subscript out of range' error @ wbNew.sheets(j).delete. Any idea?

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Saving each worksheet as a separate file (starting from a particular worksheet)

    Nice catch Andrew. Change is in red. You have to go from the back to the front when deleting the sheets. I didn't catch the error when I tested, because I have the option set to only create ONE SHEET, when Excel creates a new workbook.

    Lewis

    Try this:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 03-29-2014, 10:12 PM
  2. Saving excel worksheet extract as separate outlook draft
    By naveenrv in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-27-2013, 05:34 PM
  3. Replies: 9
    Last Post: 01-07-2009, 09:02 AM
  4. Saving to a worksheet in another file...?
    By nickclingan in forum Excel General
    Replies: 3
    Last Post: 02-03-2006, 01:15 PM

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