hg_macro_support
New Member
- Joined
- Jun 16, 2016
- Messages
- 7
Hi!
I am creating a macro and in one part of it I am attempting to move all of the sheets from one workbook to another workbook. When I attempt the macro, it comes up with an error 9 "subscript out of range". Any idea how I could fix this?
For further detail, I am deleting sheets in workbook 1, then moving all of the sheets from workbook 2 over to workbook 1 and leaving a copy of the sheets in workbook 2.
Here is where VBA says the error is coming from:
I can post a larger section of code if that helps anyone!
Thanks in advance!
I am creating a macro and in one part of it I am attempting to move all of the sheets from one workbook to another workbook. When I attempt the macro, it comes up with an error 9 "subscript out of range". Any idea how I could fix this?
For further detail, I am deleting sheets in workbook 1, then moving all of the sheets from workbook 2 over to workbook 1 and leaving a copy of the sheets in workbook 2.
Here is where VBA says the error is coming from:
Code:
Sheets(Array("DAR002", "DAR002 Chart", "DAR002 P2", "DAR002 P2 Chart", _
"DHS003 Data", "DHS003 Chart", "IRD002 Data", "IRD002 Chart", "IRD003 Data", _
"IRD003 Chart", "IRD014 Data", "IRD014 Chart", "KWC001 Data", "KWC001 Chart", _
"NOA002 Data", "NOA002 Chart", "NRL001 Data", "NRL001 Chart", "NVS002 Data", _
"NVS002 Chart", "NVS004 Data", "NVS004 Chart", "ONR007 Data", "ONR007 Chart", _
"SBR003 Data", "SBR003 Chart", "SEA001 Data", "SEA001 Chart")).Copy Before:= _
Workbooks("ASG Project Financial Sheet.xlsx").Sheets(3)
I can post a larger section of code if that helps anyone!
Thanks in advance!