Extract and Save multiple worksheets to own workbook

Samson92

New Member
Joined
May 27, 2019
Messages
18
Hi, I have a workbook that contains 32 separate sheets inside it. I would like to copy 6 of the sheet from it, but copy them to their own individual workbook and save each one as the tab name, and have them save to my desktop. Example of what I mean, some of the tabs I want are named "Accounts Open", "Accounts Close", "Accounts Withdraw" and I would like to have the workbooks named as these.

Any advice on the best way to do this?

Thanks.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
This code will copy the 'Accounts Open', 'Accounts Close' and 'Accounts Withdrawn' sheets to new, individual workbooks and save them to the desktop.
Code:
Sub SaveStuff()
Dim wbNew As Workbook
Dim strFileName As String
Dim strPath As String
Dim arrSheets()
Dim I As Long

    arrSheets = Array("Accounts Open", "Accounts Close", "Accounts Withdrawn")

    strPath = CreateObject("WScript.Shell").SpecialFolders("Desktop")
    
    For I = LBound(arrSheets) To UBound(arrSheets)
    
        strFileName = arrSheets(I)
        
        ActiveWorkbook.Sheets(arrSheets(1)).Copy
        
        Set wbNew = ActiveWorkbook
        
        With wbNew
            .SaveAs Filename:=strPath & Application.PathSeparator & strFileName, FileFormat:=xlOpenXMLWorkbook
            .Close SaveChanges:=False
        End With
        
    Next I
    
End Sub
 
Upvote 0
Hello,

This does as you ask, you need to change the location and the the names of the sheets

Code:
Sub SaveSheets()
    Dim sh As Worksheet
    Dim sLoc As String
    
    '***Change below as required
    sLoc = "C:\Test\" 'Ensure to put the backslash '\' at the end
    
    'loop thorugh all sheets
    For Each sh In ThisWorkbook.Worksheets
        
        Select Case sh.Name
            'Enter the names of all sheets separated by a comma as below
            Case "Accounts Open", "Accounts Close", "Accounts Withdraw"
                sh.Copy
                ActiveWorkbook.SaveAs Filename:=sLoc & sh.Name
                ActiveWorkbook.Close
        End Select
    Next sh
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top