马成功,马成功讲师,马成功联系方式,马成功培训师-【讲师网】
43
鲜花排名
0
鲜花数量
扫一扫加我微信
马成功:如何快速拆分Excel工作簿文件?
2016-01-20 13061
【工作需求】


有的时候经常碰到这种情况或需求:


比如一个Excel工作簿内有多个工作表,例如:sheet1\sheet2\sheet3.......

我想实现把该工作簿内的每个工作表均独立的保存为工作簿形式,比如保存为:

sheet1.xls    sheet2.xls   sheet3.xls......

【使用方法】

通过将该代码复制并粘贴到excel后台宏界面下,然后运行宏代码即可,注意宏安全性设置。

【代码如下】


   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
全部评论 (0)
热门领域讲师
互联网营销 互联网 新媒体运营 短视频 电子商务 社群营销 抖音快手 新零售 网络推广 领导力 管理技能 中高层管理 中层管理 团队建设 团队管理 高绩效团队 创新管理 沟通技巧 执行力 阿米巴 MTP 销售技巧 品牌营销 销售 大客户营销 经销商管理 销讲 门店管理 商务谈判 经济形势 宏观经济 商业模式 私董会 转型升级 数据加载错误
Message:Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source:System.Web
StackTrace: at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context) at System.Web.Mvc.ViewUserControl.ViewUserControlContainerPage.ProcessRequest(HttpContext context) at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext) at System.Web.Mvc.ViewUserControl.RenderView(ViewContext viewContext) at System.Web.Mvc.WebFormView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) at System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) at System.Web.Mvc.Html.SDRenderPartialExtensions.SDRenderPartial(HtmlHelper helper, String partialName, Object model, ViewDataDictionary viewData, Action`2 expFunc)
Message:Collection was modified; enumeration operation may not execute.
Source:mscorlib
StackTrace: at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at ASP.views_space_spacerightbar_v2_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\webs\subsite-pc.jiangshi.org\Views\Space\SpaceRightBar_v2.ascx:line 52 at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
讲师网上海站 sh.jiangshi.org 由加盟商 杭州讲师云科技有限公司 独家运营
培训业务联系:小文老师 18681582316

杭州讲师网络科技有限公司 更多城市分站招商中