'SpltSheets
Sub SplitSelectedWorkSheets()
Dim ws As Worksheet
Dim DisplayStatusBar As Boolean
Dim DestinationPath As Variant
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = ThisWorkbook.Path & "\"
.Title = "Select a destination folder or create a new destination."
.Show
If .SelectedItems.Count = 0 Then
MsgBox "Cancelled"
Exit Sub
Else
'MsgBox .SelectedItems(1)
DestinationPath = .SelectedItems(1)
End If
End With
DisplayStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.StatusBar = ActiveWindow.SelectedSheets.Count & " Remaining Sheets"
For Each ws In ActiveWindow.SelectedSheets
Dim NewFileName As String
'Macro-Enabled
'NewFileName = ThisWorkbook.Path & "\" & ws.Name & ".xlsm"
'Not Macro-Enabled
NewFileName = DestinationPath & "\" & ws.Name & ".xlsx"
ws.Copy
'ActiveWorkbook.Sheets(1).Name = "Sheet1"
'ActiveWorkbook.SaveAs Filename:=NewFileName, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.SaveAs FileName:=NewFileName, _
FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close SaveChanges:=False
Next
Application.DisplayAlerts = True
Application.StatusBar = False
Application.DisplayStatusBar = DisplayStatusBar
Application.ScreenUpdating = True
Close 'close all files and folders?
End Sub
'SpltSheets
Sub SplitGP()
Dim ws As Worksheet
Dim DisplayStatusBar As Boolean
Dim DestinationPath As Variant
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = ThisWorkbook.Path & "\"
.Title = "Select a destination folder or create a new destination."
.Show
If .SelectedItems.Count = 0 Then
MsgBox "Cancelled"
Exit Sub
Else
DestinationPath = .SelectedItems(1)
End If
End With
DisplayStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.StatusBar = ActiveWindow.SelectedSheets.Count & " Remaining Sheets"
For Each ws In ActiveWindow.SelectedSheets
Dim NewFileName As String
NewFileName = DestinationPath & "\" & ws.Cells(5, 1) & ".GP.xlsx"
ws.Copy
ActiveWorkbook.SaveAs FileName:=NewFileName, _
FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close SaveChanges:=False
Next
Application.DisplayAlerts = True
Application.StatusBar = False
Application.DisplayStatusBar = DisplayStatusBar
Application.ScreenUpdating = True
Close 'close all files and folders?
End Sub