ROBINSON_US
New Member
- Joined
- Feb 27, 2006
- Messages
- 25
I needed a quick fix to break out my worksheet tabs into separate files, so I found the code below. However, when it runs, it doesn't break anything out, it just saves one worksheet as "sheet1.xlsx". Here's the code that another user was kind enough to provide:
(it came from: Copying/Saving Worksheets from a large workbook into separate files). I'm running Office 2016. Does anyone have any ideas as to why this wouldn't work, or is there a way to specify a specific folder to save the files? The feedback from other users would indicate that it's working great for them; I'm wondering if I have some issue with Excel itself... Thanks for your input.
Sub Splitbook()
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
(it came from: Copying/Saving Worksheets from a large workbook into separate files). I'm running Office 2016. Does anyone have any ideas as to why this wouldn't work, or is there a way to specify a specific folder to save the files? The feedback from other users would indicate that it's working great for them; I'm wondering if I have some issue with Excel itself... Thanks for your input.
Sub Splitbook()
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