RichardMGreen
Well-known Member
- Joined
- Feb 20, 2006
- Messages
- 2,177
Hi all
I've run across a bit of a snag copying a list of worksheets to a new workbook.
This is the code I've currently got:-
When I run it, it creates the new workbook but then gives me a subscript out of range error when it tries to copy the sheets in the array.
Has anyone got any idea why?
I've confirmed all the sheet names are correct (copied/pasted from the sheet tabs).
If it helps I'm using 2003.
I've run across a bit of a snag copying a list of worksheets to a new workbook.
This is the code I've currently got:-
Code:
'----- Add workbook ready for sheets to be copied -----
Set wb = Workbooks.Add
'----- Copy relevant worksheets to new book -----
Sheets(Array("Front_Page", "Stage_Of_Change", "Assessments_Taken", "Basic_8_Care_Plan_1", _
"Basic_8_Care_Plan_2", "Basic_8_Care_Plan_3", "Basic_8_Care_Plan_4", "Basic_8_Care_Plan_5", _
"Basic_8_Care_Plan_6", "Basic_8_Care_Plan_7", "Basic_8_Care_Plan_8", "Clinical_Data")).Copy After:=wb.Sheets(3)
When I run it, it creates the new workbook but then gives me a subscript out of range error when it tries to copy the sheets in the array.
Has anyone got any idea why?
I've confirmed all the sheet names are correct (copied/pasted from the sheet tabs).
If it helps I'm using 2003.