I have the below macro to split workbooks. I cannot credit where I got it because I do not remember. It is a great macro with one exception, I have to set it up in each workbook where I want to use it. If I save it to the PERSONAL workbook so I can use it on multiple workbooks, it bombs out. I do not know VBA (although I want to learn it). Does anyone know what tweak I need to make to it in order to save it to the PERSONAL workbook and have it work whenever I want to use it?
Thank you in advance for any assistance you can provide.
Sub Splitbook()
'Updateby20140612
Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ThisWorkbook.Sheets
xWs.Copy
Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks