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

1.右键任意工作表—“查看代码”
2.窗口输入代码

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
        ActiveWorkbook.Close
 Next
 MsgBox "文件已经被分拆完毕!"

End Sub

3.已拆分了的工作表存于被拆分的excel在的目录下

    原文作者:Chan_pikxxx
    原文地址: https://blog.csdn.net/weixin_45980783/article/details/116661283
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞