JasonCorbett
New Member
- Joined
- Feb 19, 2022
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hello!
I am currently using a Sub that splits each worksheet from a single active workbook into the same folder that the single active workbook is located.
I would instead like to map the sheets to a folder with the same name as the sheet itself. Sheet ABC to Folder ABC, so on and so forth.
Here is the current code:
'Code Created by Sumit Bansal
Sub SplitEachWorksheet()
Dim FPath As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
ws.Copy
Application.ActiveWorkbook.SaveAs Filename:=FPath & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
------------
I have tried to update the .SaveAs path to no avail and keep getting error messages. Any help would be greatly appreciated.
Thank you!
I am currently using a Sub that splits each worksheet from a single active workbook into the same folder that the single active workbook is located.
I would instead like to map the sheets to a folder with the same name as the sheet itself. Sheet ABC to Folder ABC, so on and so forth.
Here is the current code:
'Code Created by Sumit Bansal
Sub SplitEachWorksheet()
Dim FPath As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
ws.Copy
Application.ActiveWorkbook.SaveAs Filename:=FPath & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
------------
I have tried to update the .SaveAs path to no avail and keep getting error messages. Any help would be greatly appreciated.
Thank you!