The following VBA code can help you quickly split multiple worksheets of the current workbook into separate Excel files. Please do as follows:
1. Create a new folder for the workbook that you want to split, because the split Excel files will be saved in the same folder as this master workbook.
2. Hold down the ALT + F11 keys in Excel, and it will open the Microsoft Visual Basic for Applications window.
3. Click Insert > Module, and paste the following code in the Module Window.
VBA: Split a workbook into multiple workbooks and save in the same folder
Sub Splitbook()
'Updateby20140612
Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ThisWorkbook.Sheets
xWs.Copy
Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
4. Click F5 to run the code.
(Above info is copied from here >> external link)
Leave a Comment