Hi all,
I have an excel workbook ("Master") that has multiple worksheets - two worksheets ("Overview" and "Tip Sheet") have info explaining what the workbooks are about, a third ("Datasheet") has the data for all departments, and finally worksheets for each department. I need to split the Master workbook into separate workbooks for each department that I can share with them. I tried to accomplish this using the VBA code -
Sub SplitbyService()
Dim FPath As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
If ws.Name <> "Overview" And ws.Name <> "Tip Sheet" And ws.Name <> "Datasheet" Then
ws.Copy
Application.ActiveWorkbook.SaveAs Filename:=FPath & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
However, these resulting workbooks ("New") all have a single sheet with the a department's data. I want each of the "New" workbooks to also contain both the "Overview" and "Tip Sheet" sheets as separate sheets (So a total of 3 sheets in each "New" workbook). Can someone please help me with this?
I have an excel workbook ("Master") that has multiple worksheets - two worksheets ("Overview" and "Tip Sheet") have info explaining what the workbooks are about, a third ("Datasheet") has the data for all departments, and finally worksheets for each department. I need to split the Master workbook into separate workbooks for each department that I can share with them. I tried to accomplish this using the VBA code -
Sub SplitbyService()
Dim FPath As String
FPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
If ws.Name <> "Overview" And ws.Name <> "Tip Sheet" And ws.Name <> "Datasheet" Then
ws.Copy
Application.ActiveWorkbook.SaveAs Filename:=FPath & "\" & ws.Name & ".xlsx"
Application.ActiveWorkbook.Close False
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
However, these resulting workbooks ("New") all have a single sheet with the a department's data. I want each of the "New" workbooks to also contain both the "Overview" and "Tip Sheet" sheets as separate sheets (So a total of 3 sheets in each "New" workbook). Can someone please help me with this?