请有人看看下面的marco-我有两个问题。
1,颜色从原始颜色更改。
2,将拆分后的工作表保存到最后一个文件夹中,但我没有将某些内容保存到marco中定义的文件中。
Sub SaveSheets()
' Save sheets as seperate workbooks
'
' Keyboard Shortcut: Ctrl+Shift+W
'
Dim wbDest As Workbook
Dim wbSource As Workbook
Dim sht As Object 'Could be chart, worksheet, Excel 4.0 macro,etc.
Dim strSavePath As String
On Error GoTo ErrorHandler
Application.ScreenUpdating = False 'Don't show any screen movement
strSavePath = "C:\Users\gary odea\Documents\Save Sheets" 'Change this to suit your needs
Set wbSource = ActiveWorkbook
For Each sht In wbSource.Sheets
sht.Copy
Set wbDest = ActiveWorkbook
wbDest.SaveAs sht.Name & ""
Next
Application.ScreenUpdating = True
Exit Sub
ErrorHandler: 'Just in case something hideous happens
MsgBox "An error has occurred. Error number=" & Err.Number & ". Error description=" & Err.Description & "."
End Sub