一个工作簿中包括N个工作表,将各个工作表拆分成工作簿。
工作表数量不定,表内内容不限,拆分后保存于当前文件夹内。
Sub Sample()
Dim MySheetsCount As Long
For MySheetsCount = 1 To Sheets.Count
Sheets(MySheetsCount).Copy
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & Sheets(1).Name & ".xlsx"
ActiveWindow.Close
Next
End Sub
原文地址:https://www.cnblogs.com/officeplayer/p/11028948.html
时间: 2024-11-08 22:51:03