+ Reply to Thread
Results 1 to 8 of 8

Macro to list worksheets and have an option to save selected sheets as separate workbook

  1. #1
    Forum Contributor
    Join Date
    12-19-2012
    Location
    Bengaluru
    MS-Off Ver
    Excel 2013
    Posts
    108

    Macro to list worksheets and have an option to save selected sheets as separate workbook

    Hi,

    I'm looking for a macro which list the total sheets in an active workbook and provide an option to select multiple worksheets at once and then save them as different workbooks.

    I tried searching for it but all efforts are in Vain.

    Can someone help on this.

    Thanks in Advance.

    Regards
    Click on the star * if some1 helped you.

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Macro to list worksheets and have an option to save selected sheets as separate workbo

    Where are you searching, Ask Jeeves?

    list all files in workbook (first result in Google)
    http://www.ozgrid.com/forum/showthread.php?t=61138

    You can save the list to a worksheet....use a simple method of sheet selection, like put a * in the next column, and then record yourself selecting and saving said sheets. Add a for next loop to look for your selection marker and.....job done.

    Google 'VBA for next loops' for info on that.

  3. #3
    Forum Contributor
    Join Date
    12-19-2012
    Location
    Bengaluru
    MS-Off Ver
    Excel 2013
    Posts
    108

    Re: Macro to list worksheets and have an option to save selected sheets as separate workbo

    Hi Belly Gas

    Thanks for the response.

    The workbook will not remain the same. In this case i can't use the recording part

  4. #4
    Forum Contributor
    Join Date
    12-19-2012
    Location
    Bengaluru
    MS-Off Ver
    Excel 2013
    Posts
    108

    Re: Macro to list worksheets and have an option to save selected sheets as separate workbo

    Hi Belly Gas

    Thanks for the response.

    The workbook will not remain the same. In this case i can't use the recording part

  5. #5
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Macro to list worksheets and have an option to save selected sheets as separate workbo

    You can use the recorder to get the correct format for the command. Then you can replace the part of the command that shows the workbook (ie c:\whereever\whereever\workbook.xlsx) and replace that with a string variable which you can either populate from a user input box or....any way you like really.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Macro to list worksheets and have an option to save selected sheets as separate workbo

    Example file list all sheets in multiselect Listbox.
    Select the sheets you want to save and click button.
    Selected sheets will be saved in DefaultPath (which you have to adapt before running code) with the sheetname as filename.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Contributor
    Join Date
    12-19-2012
    Location
    Bengaluru
    MS-Off Ver
    Excel 2013
    Posts
    108

    Re: Macro to list worksheets and have an option to save selected sheets as separate workbo

    Hi bakerman2

    Thanks a ton for the help. This is what i was looking for.

    However when i use the same code and try to create the same i'm unable to select multiple sheets at once. I'm not sure of what i'm missing.

    Can you please help me with that.

    Thanks

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Macro to list worksheets and have an option to save selected sheets as separate workbo

    In the Properties window of the ListBox you have to set MultiSelect to 1 - fmMultiSelectMulti.

+ 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. Save workbook as option selected from drop down list in same path
    By Richavlaues in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2016, 04:37 PM
  2. [SOLVED] Macro to save three worksheets from a workbook into a separate file
    By robertguy in forum Excel General
    Replies: 2
    Last Post: 09-09-2015, 04:15 AM
  3. [SOLVED] Macro to save selected worksheets as workbooks in variable location
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-25-2015, 10:32 AM
  4. Macro to auto-email separate worksheets of same workbook to separate recipients?
    By Sean Anderson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2007, 09:51 PM
  5. [SOLVED] How to return a list of all selected Sheets in a Workbook
    By Felix in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-10-2006, 12:15 PM
  6. Macro to save sheets as separate workbooks
    By Zorro in forum Excel General
    Replies: 3
    Last Post: 09-27-2005, 07:05 PM
  7. [SOLVED] How do I save sheets in a workbook to separate files?
    By Omzala in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-13-2005, 03:06 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