如何将EXCEL工作薄按工作表拆分为多个工作薄
答案:2 悬赏:0 手机版
解决时间 2021-02-25 08:48
- 提问者网友:嗝是迷路的屁
- 2021-02-24 19:24
如何将EXCEL工作薄按工作表拆分为多个工作薄
最佳答案
- 五星知识达人网友:不想翻身的咸鱼
- 2021-02-24 19:45
开发工具选项卡——控件中选“查看代码”——工程栏中“插入”“模块”
将下列代码复制粘贴进去——运行。
Private Sub 分拆工作表()
Dim sht As Worksheet
Dim MyBook As Workbook
Set MyBook = ActiveWorkbook
For Each sht In MyBook.Sheets
sht.Copy
ActiveWorkbook.SaveAs Filename:=MyBook.Path & "\" & sht.Name, FileFormat:=xlNormal
ActiveWorkbook.Close
Next
MsgBox "文件分拆完毕!"
End Sub
将下列代码复制粘贴进去——运行。
Private Sub 分拆工作表()
Dim sht As Worksheet
Dim MyBook As Workbook
Set MyBook = ActiveWorkbook
For Each sht In MyBook.Sheets
sht.Copy
ActiveWorkbook.SaveAs Filename:=MyBook.Path & "\" & sht.Name, FileFormat:=xlNormal
ActiveWorkbook.Close
Next
MsgBox "文件分拆完毕!"
End Sub
全部回答
- 1楼网友:十年萤火照君眠
- 2021-02-24 19:59
将每一个工作表保存为一个工作薄。
打开工作表》alt+f11》粘贴下列代码》运行代码。
sub
savesheet()
application.screenupdating = false
for each ws in thisworkbook.worksheets
ws.copy
activeworkbook.saveas filename:= _
thisworkbook.path & "\" &
ws.name, fileformat:=xlopenxmlworkbook _
, password:="",
writerespassword:="", readonlyrecommended:=false, _
createbackup:=false
activeworkbook.close
next
application.screenupdating = true
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯