Search This Blog

Monday, February 20, 2017

How to create separate excel files for each sheet in the Excel File



How to create separate excel files for each sheet in the Excel File.

1.       Open the excel file from a folder which has multiple sheets data , press Alt + F11 Open Microsoft Visual Basic
2.       Click Insert>Module and paste the below code


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 & ".xls"
    Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

3.      Press F5 to run the code.

No comments:

Post a Comment