2,在開啟的視窗中輸入如下程式碼:
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:=xlOpenXMLWorkbook "將工作簿另存為xlsx格式 ActiveWorkbook.Close
Next
MsgBox "檔案已經被分拆完畢!"
End Sub
4,拆分成功後,會彈出視窗提示。
5,返回Excel工作簿檔案所在路徑 即可檢視已經拆分的工作薄。
2,在開啟的視窗中輸入如下程式碼:
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:=xlOpenXMLWorkbook "將工作簿另存為xlsx格式 ActiveWorkbook.Close
Next
MsgBox "檔案已經被分拆完畢!"
End Sub
4,拆分成功後,會彈出視窗提示。
5,返回Excel工作簿檔案所在路徑 即可檢視已經拆分的工作薄。