我收到以下代码的错误:
Sub CheckColor(myCell As Range, myNameToShape As String, myValueToColor As String)
Dim myShape As Shape
Dim myTargetCell As Range
Dim myColorCode As Long
On Error GoTo Catch
Set myTargetCell = Range(myNameToShape).Columns(1).Find(myCell.Name.Name, LookAt:=xlWhole)
Set myShape = ActiveSheet.Shapes(myTargetCell.Offset(0, 1))
GoTo Finally
Catch:
Exit Sub
Finally:
On Error GoTo 0
If myCell.Value < Range(myValueToColor).Cells(2, 1).Value Then
myColorCode = Range(myValueToColor).Cells(1, 2).Value
Else
myColorCode = Application.WorksheetFunction.VLookup(myCell.Value,
Range(myValueToColor), 2, True)
End If
myShape.Fill.ForeColor.RGB = myColorCode
End Sub
Sub UpdateMap()
Dim myCell As Range
Dim ws1 As Worksheet
Set ws1 = ActiveWorkbook.Sheets("Control")
Application.ScreenUpdating = False
For Each myCell In ws1.Range("MapNameToShape").Columns(1).Cells
CheckColor Range(myCell.Value), "MapNameToShape", "MapValueToColor"<<< **The error is happened to be in this line**
Next myCell
Application.ScreenUpdating = True
End Sub