Hi Kev,
Thanks very much for getting back to me. While you're code works perfectly, I've found that not all sheets between the two I identified above are ones that can be used. So I need to take a different approach. Below is the code I'm using which currently hardcode identifies the sheets to be selected:
Sub Split_Reps()
Dim strPath As String
Dim myFile As String
Dim ws As Worksheet
Dim wbNew As Workbook
Application.ScreenUpdating = False
MsgBox ("Location file")
myFile = Application.GetOpenFilename
Workbooks.Open (myFile)
ArrayOne = Sheets(Array("AAA", "BBB", "CCC", _
"DDD", "EEE")).Select
MsgBox ("Identify where to save")
strPath = Application.GetSaveAsFilename
Sheets(ArrayOne).Select
For Each ws In ActiveWindow.SelectedSheets
ws.Copy
Set wbNew = ActiveWorkbook
Workbooks("Model.xlsm").Sheets("Data").Copy after:=wbNew.Sheets(1)
Worksheets(1).UsedRange.Value = Worksheets(1).UsedRange.Value
Worksheets("Data").Range("A22").Value = Worksheets(1).Range("B44").Value
BreakLinks wbNew
wbNew.Close True, ws.Name & ".xlsx"
Next
Application.ScreenUpdating = True
End Sub
How can I adjust the code so that instead of hardcoding the sheet names to create ArrayOne that I can just open the workbook (myFile) and select all the sheets? The selected sheets would be stored as ArrayOne and continue on with the code.
Any ideas?
Thanks!!
Bookmarks