Hi All
I have this code which splits the multiple excel worksheets into individual excel file and saves it all in location as specified.
Each Excel file is named after the sheet name.
I basically have 5 sheets say MODELA, MODELB, MODELC, MODELD,and MODELE.
what i want is, I have one more Sheet called DATA, which needs to come along with each 5 Workbook after the split.
Ex: ModelA work book shoul have MODELA sheet and DATA Sheet but the excel file name should be MODELA and So on.
Sub NewWBS()
Dim PathA As String, PathB As String, PathC As String, PathD As String, PathE As String
Dim wbNew As Workbook
Dim ws As Worksheet
PathA = "c:\myFolde\mysubfolderforModelA"
'etc for the others
For Each ws In ThisWorkbook.Worksheets
ws.Copy
Set wbNew = ActiveWorkbook
If ws.Name = "ModelA" Then wbNew.SaveAs PathA & "\" & ws.Name
If ws.Name = "ModelB" Then wbNew.SaveAs PathB & "\" & ws.Name
If ws.Name = "ModelC" Then wbNew.SaveAs PathC & "\" & ws.Name
If ws.Name = "ModelD" Then wbNew.SaveAs PathD & "\" & ws.Name
If ws.Name = "ModelE" Then wbNew.SaveAs PathE & "\" & ws.Name
wbNew.Close
Next ws
End Sub
Thanks in advance
Bookmarks