Please bear with me...learning as I go
I have a macro that I have run successfully in Excel for the past two years but continue to get the following message on my latest project: "Run-time error '-2147024809 (80070057') The index into the specified collection is out of bounds". I am referencing more shapes than I have done in previous iterations (204 shapes in file) but not sure if that has anything to do with the issue. The macro follows:
Sub MapMacro()
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">For i =5To207
Range("actReg").Value = Range("A"& i).Value
If ActiveSheet.Name ="Variables"Then
Worksheets("Map").Activate
EndIf
ActiveSheet.Shapes(Range("actReg").Value).Select
Selection.ShapeRange.Fill.ForeColor.RGB = Range(Range("actRegCode").Value).Interior.Color
If ActiveSheet.Name ="Map"Then
Worksheets("Variables").Activate
EndIf
Next i
Range("A1").Select
</code>End Sub
Any assistance is greatly appreciated!!!
I have a macro that I have run successfully in Excel for the past two years but continue to get the following message on my latest project: "Run-time error '-2147024809 (80070057') The index into the specified collection is out of bounds". I am referencing more shapes than I have done in previous iterations (204 shapes in file) but not sure if that has anything to do with the issue. The macro follows:
Sub MapMacro()
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">For i =5To207
Range("actReg").Value = Range("A"& i).Value
If ActiveSheet.Name ="Variables"Then
Worksheets("Map").Activate
EndIf
ActiveSheet.Shapes(Range("actReg").Value).Select
Selection.ShapeRange.Fill.ForeColor.RGB = Range(Range("actRegCode").Value).Interior.Color
If ActiveSheet.Name ="Map"Then
Worksheets("Variables").Activate
EndIf
Next i
Range("A1").Select
</code>End Sub
Any assistance is greatly appreciated!!!