Managing large Excel files with multiple sheets? ๐ฉ Want to separate each worksheet into its own Excel file โ with all formulas and formatting intact?
This step-by-step guide will help you do exactly that using a simple VBA macro! ๐ป
โ Why You Might Need This
- You have a workbook with 25+ sheets and want to save them individually.
- You want to preserve formulas, formatting, and structure.
- You want an easy way to select the destination folder for the split files.
๐ ๏ธ Example Used in This Blog
In this example, we created a sample workbook called Sales_Report_2025.xlsm
with 3 sheets:
- North
- South
- West
Each sheet contains:
- Product sales data ๐๏ธ
- Formulas (like
=Quantity * Price
) to auto-calculate totals - Proper formatting (bold headers, colored cells, โน currency format)
๐ Screenshot: Sample data in โNorthโ sheet ๐

๐ Screenshot: Sample data in โSouthโ sheet ๐

๐ Screenshot: Sample data in โWestโ sheet ๐

๐ VBA Macro to Split Worksheets
Hereโs the VBA code to copy-paste into your Excel:
๐งฉ What It Does:
- Prompts you to select a destination folder
- Saves each sheet as its own
.xlsx
file - Preserves formulas, formatting, and layout
๐ Steps to Run the Macro:
- Press
Alt + F11
to open the VBA Editor. - Insert โ Module
- Paste the following code:
Sub ExportSheetsToFiles()
Dim ws As Worksheet
Dim FolderPath As String
Dim NewWorkbook As Workbook
FolderPath = "C:\Users\PREMIUM\Desktop\Excel Data\Extracted\" ' Change the path to your desired folder
On Error GoTo ErrorHandler ' Enable error handling
For Each ws In ThisWorkbook.Sheets
ws.Copy ' Create a new workbook with the copied sheetSet NewWorkbook = ActiveWorkbook ' Reference the new workbook ' Save the new workbook NewWorkbook.SaveAs FolderPath & ws.Name & ".xlsx" NewWorkbook.Close SaveChanges:=False ' Close the new workbook without saving changes again Application.Wait (Now + TimeValue("0:00:02")) ' Wait for 2 seconds to prevent Excel from freezing
Next ws
MsgBox "All sheets have been saved successfully!", vbInformation ' Confirmation message
Exit Sub
ErrorHandler:
MsgBox "An error occurred: " & Err.Description, vbCritical ' Show an error message if something goes wrong
End Sub
๐ Final Output Example
After running the macro:
- You’ll have 3 separate files:
North.xlsx
South.xlsx
West.xlsx
- Each file will contain the original formatting, formulas, and values ๐ฏ
๐ฅ Try it out and share your feedback in the comments!
Download the Sample file : Sales_Report_2025.xlsm