在工作中可能会遇到将一个excel文件中的很多个excel文档,需要将工作簿拆分为单个的excel文档
拆分excel文件
先按Alt+F11,插入模板,拷贝下面代码F5执行
Sub SaveSeparately()
Dim sht As Worksheet
Application.ScreenUpdating = False
ipath = ThisWorkbook.Path & "\"
For Each sht In Sheets
sht.Copy
ActiveWorkbook.SaveAs ipath & sht.Name & ".xls"
ActiveWorkbook.Close
Next
Application.ScreenUpdating = True
End Sub
网友评论