Hi All
I've got myself a piece of code that splits each sheet in a workbook into it's own workbook. I've been using this forever (6+ years) in several different jobs I've had and it's done me well.
However, is there a means to make it skip hidden sheets as for the particular workbook I'm working off, theres a 60mb sheet that I don't need splitting (compared to the others which are only 60-70kb) and it slows down the process so much.
At present the code is as follows
I've got myself a piece of code that splits each sheet in a workbook into it's own workbook. I've been using this forever (6+ years) in several different jobs I've had and it's done me well.
However, is there a means to make it skip hidden sheets as for the particular workbook I'm working off, theres a 60mb sheet that I don't need splitting (compared to the others which are only 60-70kb) and it slows down the process so much.
At present the code is as follows
VBA Code:
Sub SaveSheets()
' Save sheets as seperate workbooks
'
' Keyboard Shortcut: Ctrl+Shift+W
Dim wbDest As Workbook
Dim wbSource As Workbook
Dim sht As Object
Dim strSavePath As String
On Error GoTo ErrorHandler
Application.ScreenUpdating = False
strSavePath = "C:\Users\XXXXXX\OneDrive - XXXXXXX\Documents\Temp\New folder\" 'Change this to suit your needs
Set wbSource = ActiveWorkbook
For Each sht In wbSource.Sheets
sht.Copy
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Set wbDest = ActiveWorkbook
wbDest.SaveAs strSavePath & "Dashboard - " & sht.Name
wbDest.Close
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