Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zhimiaoli/9967169 to your computer and use it in GitHub Desktop.
Save zhimiaoli/9967169 to your computer and use it in GitHub Desktop.
Sub Splitbook()
MyPath = ThisWorkbook.Path
For Each sht In ThisWorkbook.Sheets
sht.Copy
ActiveSheet.Cells.Copy
ActiveSheet.Cells.PasteSpecial Paste:=xlPasteValues
ActiveSheet.Cells.PasteSpecial Paste:=xlPasteFormats
ActiveWorkbook.SaveAs _
Filename:=MyPath & "\" & sht.Name & ".xls"
ActiveWorkbook.Close savechanges:=False
Next sht
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment