如果我们要把多个工作表拆分成多工作簿,可以采用多种办法。面对重复、单调的工作,我们一定要思考能否用VBA来解决。VBA只需要编写一串代码,就能解决复杂的问题。今天我们来学习用VBA,一键搞定多工作表拆分多工作簿。操作步骤:1、编写VBA代码打开excel,鼠标右击——查看代码,输入以下代码:Sub 拆分工作表() Dim b As Worksheet Excel.Application.ScreenUpdating = False For Each b In Sheets b.Copy Excel.ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & b.Name & ".xlsx" Excel.ActiveWorkbook.Close Next Excel.Application.ScreenUpdating = TrueEnd Sub2、运行VBA代码运行就能快速将所有工作表拆分成一个个工作簿。GIF操作如下:
当然我们亦可以插入一个按钮,将按钮指定宏,通过按按钮,来运行宏,这样也是可以的。
如果要学习其他的VBA教程,可以在历史文章中输入:VBA,进行搜索,进行学习。
原创不易,日更不易,希望各位看官,多转发,多点赞,多支持。看完有收获,点亮:在看,分享给身边好友,一起学习,一起进步。