A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
You'll have to allow macros when you open the workbook. One way to do that is to make the folder that contains the workbook a trusted location for Excel (File > Options > Trust Center > Trust Center Settings... > Trusted Locations).
This code works for me in your workbook:
Sub ShapeColor()
Dim Shp As Shape
For Each Shp In Sheets("Sheet2").Shapes
If InStr(1, Shp.TextFrame2.TextRange.Text, "1", vbTextCompare) > 0 Then
Shp.Fill.ForeColor.RGB = 2550
ElseIf InStr(1, Shp.TextFrame2.TextRange.Text, "2", vbTextCompare) > 0 Then
Shp.Fill.ForeColor.RGB = 25512
ElseIf InStr(1, Shp.TextFrame2.TextRange.Text, "3", vbTextCompare) > 0 Then
Shp.Fill.ForeColor.RGB = 255255
ElseIf InStr(1, Shp.TextFrame2.TextRange.Text, "4", vbTextCompare) > 0 Then
Shp.Fill.ForeColor.RGB = 155255
ElseIf InStr(1, Shp.TextFrame2.TextRange.Text, "5", vbTextCompare) > 0 Then
Shp.Fill.ForeColor.RGB = 25534
End If
Next Shp
End Sub