首页 > 其他分享 >Excel工作簿拆分为多个Excel文件

Excel工作簿拆分为多个Excel文件

时间:2022-12-11 18:22:05浏览次数:47  
标签:xpath 文件 sht Sub 多个 Dim Excel ActiveWorkbook

准备工作:微软Office Excel

 

操作步骤:

第一步,

 

 第二步

第三步,复制下面这一段代码,立即执行

Sub 拆分工作薄()

Dim xpath As String

xpath = ActiveWorkbook.Path

Dim sht As Worksheet

For Each sht In ActiveWorkbook.Sheets

sht.Copy

ActiveWorkbook.SaveAs Filename:=xpath & "\" & sht.Name & ".xlsx"

ActiveWorkbook.Close

Next

MsgBox "工作薄拆分完毕!"

End Sub

 

 

 

 

 

标签:xpath,文件,sht,Sub,多个,Dim,Excel,ActiveWorkbook
From: https://www.cnblogs.com/fxcoding/p/16974091.html

相关文章