excel按sheet将表格拆分成独立表格
2020-03-09 本文已影响0人
百试成神
sheet表转独立的表格
方案一:
已测试有效,拆分表格到当前文件夹中
Sub sheet转独立文件()
Dim sht As Worksheet
Application.ScreenUpdating = False
ipath = ThisWorkbook.Path &"\"
For Each sht In Sheets
sht.Copy
ActiveWorkbook.SaveAs ipath & sht.Name
ActiveWorkbook.Close
Next
Application.ScreenUpdating = True
End Sub
方案二:
拆分表格到3月文件夹下
Sub 拆分表格()
Dim x As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
For x = 2 To 32
Sheets(x).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Path & "/3月/" & Sheets(x).Name & ".xlsx"
.Close True
End With
Next x
Application.ScreenUpdating = True
End Sub