VBA EXCEL拆分工作表为工作薄

2023-05-07 09:18:12   文档大全网     [ 字体: ] [ 阅读: ]

#文档大全网# 导语】以下是®文档大全网的小编为您整理的《VBA EXCEL拆分工作表为工作薄》,欢迎阅读!
工作,拆分,EXCEL,VBA

Sub 工作簿拆分()

'将EXCEL工作簿按工作表拆分为工作簿

Dim PATH As String

PATH = Application.ActiveWorkbook.PATH

Dim sht As Worksheet

Application.ScreenUpdating = False

For Each sht In Sheets

sht.Copy

ActiveWorkbook.SaveAs PATH & "\" & sht.Name & ".xlsx" '(工作表名称文件名)

ActiveWorkbook.Close

Next

Application.ScreenUpdating = True

End Sub

Sub UnhideAllSheets()

For Each Sheet In ActiveWorkbook.Sheets

Sheet.Visible = True

Next

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

本文来源:https://www.wddqxz.cn/a0ac23a8adaad1f34693daef5ef7ba0d4a736d94.html

相关推荐