Split multiple sheets of an excel file into multiple excel files

Sub SplitWorkBook() ' Split Workbook

Dim ws As Worksheet

 Application.ScreenUpdating = False
 For Each ws In ThisWorkbook.Worksheets
 ws.Copy
 Workbooks(Workbooks.Count).SaveAs ThisWorkbook.Path & "\" & "Use what you want Filename prefix replace here" & ws.Name
 ActiveWorkbook.Close
 Next
 Application.ScreenUpdating = True
End Sub

 

How to use: Open excel, there should be a macro menu under the view, click to view macro, enter a macro name to create a macro, copy and paste this code, and then click execute or run, the split file and the original The files are in the same folder.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327054782&siteId=291194637