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
Pingback: EXCEL VBA笔记(不断更新中) | 津津有味Jjuv Blog
宏有效,谢谢,就是不能自动保存成多个文件,比较麻烦,建议修改成自动保存成多个文件,那样就比较完美了。
保存文档时,会根据sheet name来另存啊