Excel工作簿中工作表分别保存为文件


Sub fenchai()
On Error Resume Next
Dim WB As Workbook, i As Integer
Set WB = ThisWorkbook
For i = 1 To WB.Worksheets.Count '获得工作簿中表的个数
WB.Worksheets(i).Copy '复制工作表
ActiveWorkbook.SaveAs Filename:="c:\分拆文档\" & WB.Worksheets(i).Name & "TB.xls" '保存文档
ActiveWindow.Close
Next i
End Sub

Join the Conversation

3 Comments

  1. 宏有效,谢谢,就是不能自动保存成多个文件,比较麻烦,建议修改成自动保存成多个文件,那样就比较完美了。

Leave a comment

Your email address will not be published. Required fields are marked *