jordancollins
New Member
- Joined
- Jul 29, 2022
- Messages
- 3
Hello, I am trying to save multiple worksheets within one file to the same file location without having to pick the folder for every file that is being saved. The file that I am currently working in has 20 sheets that get saved. I am sure that I am missing something silly...
Sub SplitEachWorksheet()
Dim FilePath As String
Dim Fldr As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
If Not ws.Name Like "Summary" Then
ws.Copy
With Application.FileDialog(4)
.AllowMultiSelect = False
If .Show <> -1 Then Exit Sub
Fldr = .SelectedItems(1)
End With
ActiveWorkbook.SaveAs Fldr & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Else
End If
Next ws
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Sub SplitEachWorksheet()
Dim FilePath As String
Dim Fldr As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
If Not ws.Name Like "Summary" Then
ws.Copy
With Application.FileDialog(4)
.AllowMultiSelect = False
If .Show <> -1 Then Exit Sub
Fldr = .SelectedItems(1)
End With
ActiveWorkbook.SaveAs Fldr & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Else
End If
Next ws
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub