快生活 - 生活常识大全

实例拆分工作薄


  Sub 拆分工作薄()
  Dim sht As Worksheet "定义一个工作表变量 sht
  Dim mybook As Workbook
  "定义一个工作簿变量 mybook
  Application.ScreenUpdating = False
  Set mybook = ActiveWorkbook
  VBA.MkDir (mybook.Path & "分后数据")
  For Each sht In mybook.Sheets
  sht.Copy
  With ActiveWorkbook
  .SaveAs Filename:=mybook.Path & "分后数据" & sht.Name, FileFormat:=56
  .Close
  End With
  Next
  Application.ScreenUpdating = True
  End Sub
网站目录投稿:惜海