G
Guest
For Each turnplot In
Workbooks("AF-Scenario").Worksheets("HexArray").Range("D30
429").Cells
is causing a "Runsub script out of range" error.
AF-Scenario is open but is not the active sheet (the macro is running from
the active sheet and the code inside the loops are drawing shapes and lines
to the active sheet)
The error occurs, the very first time, the For Each... is executed. The
loop statment getting the error is the fourth loop in the macro. The other 3
loops are working fine and all 3 use this type of code:
For Each n In
Workbooks("AF-Scenario.xls").Worksheets("HexArray").Range("D30
429").Cells
Why would this kind of loop work 3 times in a row then the 4th time (only
difference is that "n" is now "turnplot") it gets the subscript error...
I am deleting a group of autoshapes (on the active sheet) in a loop just
prior to the 4th loop. But I do the same thing for all the lines just prior
to the 1st loop.
The 1st three loops are looking at the exact same range of cells even...
Any suggestions are appreciated.
Workbooks("AF-Scenario").Worksheets("HexArray").Range("D30
429").Cellsis causing a "Runsub script out of range" error.
AF-Scenario is open but is not the active sheet (the macro is running from
the active sheet and the code inside the loops are drawing shapes and lines
to the active sheet)
The error occurs, the very first time, the For Each... is executed. The
loop statment getting the error is the fourth loop in the macro. The other 3
loops are working fine and all 3 use this type of code:
For Each n In
Workbooks("AF-Scenario.xls").Worksheets("HexArray").Range("D30
429").CellsWhy would this kind of loop work 3 times in a row then the 4th time (only
difference is that "n" is now "turnplot") it gets the subscript error...
I am deleting a group of autoshapes (on the active sheet) in a loop just
prior to the 4th loop. But I do the same thing for all the lines just prior
to the 1st loop.
The 1st three loops are looking at the exact same range of cells even...
Any suggestions are appreciated.