1 2 3 4

Excel-宏-将Excel多个工作表拆分成多个单独的Excel

1.原文件

2.拆分后

3.具体操作:打开需要拆分的excel,在任意工作表右击,点击“查看代码”

输入代码

Private Sub 分拆工作表()
       Dim sht As Worksheet
       Dim MyBook As Workbook
       Set MyBook = ActiveWorkbook
       For Each sht In MyBook.Sheets
           sht.Copy
           ActiveWorkbook.SaveAs Filename:=MyBook.Path & "\" & sht.Name, FileFormat:=xlOpenXMLWorkbook     '将工作簿另存为xlsx格式
           ActiveWorkbook.Close
       Next
       MsgBox "文件已经被分拆完毕!"
   End Sub

4.执行

5.遇到的问题

点击是继续即可

posted @ 2022-01-14 15:14  Maggie1010  阅读(3551)  评论(0编辑  收藏  举报