OK, done that, got the crash.
With Worksheets("MainMap")
For intState = 1 To rngStates.Rows.Count
strStateName = rngStates.Cells(intState, 1).Text
intStateValue = rngStates.Cells(intState, 2).Value
intColorLookup = Application.WorksheetFunction.Match(intStateValue, Range("STATE_COLORS_VISITS"), True)
With .Shapes(strStateName)
.Fill.Solid
.Fill.ForeColor.RGB = rngColors.Cells(intColorLookup, 1).Offset(0, 1).Interior.Color
End With
Next
End With
intState = 22
strStateName = MICHIGAN
intStateValue = 55
?rngstates.Address
$A$2:$B$51
rngStates.Rows.Count = 50
I'm guessing the problem is here:
Sub ChangeColor()
Dim LastRow As Long
Dim FullRange As Variant
Dim cell As Variant
With ActiveSheet
LastRow = Range("E" & Rows.Count).End(xlUp).Row
End With
Set FullRange = Range("E2:E" & LastRow)
For Each cell In FullRange
There's nothing in column E so that range becomes E1:E2 as Lastrow will be 1.
Have you tidies up the worksheet and not changed the code to match?
Regards, TMS
Bookmarks