How to I change the code below so it will run for all sheets in the workbook?
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"
With Application
.DisplayAlerts = False
.ScreenUpdating = False
With ActiveWorkbook
.Saveas FileFormat:=xlNormal, Password:="2012270400", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
.Close
End With
.ScreenUpdating = True
.DisplayAlerts = True
End With
ActiveWorkbook.Close savechanges:=False
Next sht
End Sub
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"
With Application
.DisplayAlerts = False
.ScreenUpdating = False
With ActiveWorkbook
.Saveas FileFormat:=xlNormal, Password:="2012270400", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
.Close
End With
.ScreenUpdating = True
.DisplayAlerts = True
End With
ActiveWorkbook.Close savechanges:=False
Next sht
End Sub