Try the following:
- Copy the VBA code below and paste into the VBA editor
- Change back to the worksheet containing the shapes
- Ungroup the shapes (Can't assign macro to individual shapes while grouped)
- Select each shape in turn (right click)
- Select "Assign macro" from the dialog
- Select the macro name (SelectedShape) and OK. (All shapes assigned to the same macro)
- Select all of the shapes required for the group and Regroup
- Now you can click an individual shape and the code sets the forecolor.
Additional tip to determine the RGB color code
- Select an Ungrouped shape (Doesn't work with grouped shapes)
- Click the Dropdown against the Fill color icon on the Home ribbon
- Can change color at this point or leave color as is.
- Select More colors (bottom of color grid dialog)
- Select Custom tab (at top of dialog)
- R, G, B color codes displayed. (Can also adjust color here on the spectrum)
NOTE: All of the shapes are assigned to the same VBA macro and Application.Caller determines which shape called the code.
Feel free to get back to me for further assistance if anything not clear or not working as required. Example code tested in Excel Office 365
Sub SelectedShape()
Dim strShapeName As String
Dim shpSelected As Shape
strShapeName = Application.Caller
Set shpSelected = ActiveSheet.Shapes(strShapeName)
'Following examples of code to set color of shape
'Only uncomment one of the lines and comment all others
'shpSelected.Fill.ForeColor.RGB = RGB(0, 0, 255) 'Blue
'shpSelected.Fill.ForeColor.RGB = RGB(255, 255, 255) 'Green
shpSelected.Fill.ForeColor.RGB = vbBlue 'Blue 'Examples of code to set color of shape
'shpSelected.Fill.ForeColor.RGB = vbGreen 'Green
End Sub