Доброе время суток.
Вариант для разбора в качестве помощи.
[vba]Код
Public Sub Test()
Dim pShape As Shape, pCell As Range
Set pShape = getShapeByTextRangeValue("2")
Set pCell = getCellByValue(2)
If Not (pShape Is Nothing Or pCell Is Nothing) Then
pShape.Fill.BackColor.RGB = pCell.Interior.Color
End If
End Sub
Private Function getShapeByTextRangeValue(ByVal withValue As String) As Shape
Dim pShape As Shape, result As Shape
Set result = Nothing
For Each pShape In ActiveSheet.Shapes
If pShape.Type = msoFreeform Then
If pShape.TextFrame2.TextRange.Text = withValue Then
Set result = pShape
Exit For
End If
End If
Next
Set getShapeByTextRangeValue = result
End Function
Private Function getCellByValue(ByVal withValue As Long) As Range
Dim pCell As Range, result As Range
Set result = Nothing
For Each pCell In ActiveSheet.UsedRange
If pCell.Value = withValue Then
Set result = pCell
Exit For
End If
Next
Set getCellByValue = result
End Function
[/vba]