Printing/saving excel workbook with multiple tabs as singular excel files based on cell content

thmartin

New Member
Joined
Mar 3, 2022
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I have an excel file containing multiple tabs that i need to print/save as individual excel files. The name of each excel file is a given cell on the individual worksheet.

Example:

Sheet1 cell C6 = "Target Revenue" - I would need to print a new excel file saved in the same folder named "Target Revenue" containing the contents of just Sheet1
Sheet2 cell C6 = "Target GP" - I would need to print a new excel file saved in the same folder named "Target GP" containing the contents of just Sheet2

There are numerous tabs, and i have been doing this manually with the "Move or Copy" feature, but i feel as though there must be an easier way.

Thanks,
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
7,546
Try this macro.
VBA Code:
Public Sub Save_Each_Sheet_As_Workbook()

    Dim ws As Worksheet
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False  'suppress warning if .xlsx file already exists - file is replaced
    
    With ActiveWorkbook
        For Each ws In .Worksheets
            ws.Copy
            ActiveWorkbook.SaveAs .Path & "\" & Range("C6").Value & ".xlsx"
            ActiveWorkbook.Close SaveChanges:=False
        Next
    End With
    
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    
    MsgBox "Done"
    
End Sub
 

Forum statistics

Threads
1,176,091
Messages
5,901,363
Members
434,887
Latest member
zoath

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
Top