Hi everyone.
I have some VBA Code that works well to change the colour of a shape, dependent upon a cell value.
Some of the shape colour choices do not work well with white font, eg a bright yellow shape, but this is the colour of choice!
Here is my code and I wondered if someone could please tell me the add in code I need to change the font colour at the same time as changing the shape colour?
Thank you in advance
I have some VBA Code that works well to change the colour of a shape, dependent upon a cell value.
Some of the shape colour choices do not work well with white font, eg a bright yellow shape, but this is the colour of choice!
Here is my code and I wondered if someone could please tell me the add in code I need to change the font colour at the same time as changing the shape colour?
Thank you in advance
VBA Code:
Private Sub Worksheet_Calculate()
Dim rngC As Range
Dim shp As Shape
For Each rngC In Me.Range("R8:R39")
Set shp = Me.Shapes("tbox" & rngC.Row - 7)
shp.Fill.ForeColor.RGB = RGB(166, 166, 166)
If Sheet14.Cells(rngC.Row, 18) = "Chaos" Then
shp.Fill.ForeColor.RGB = RGB(255, 0, 0)
ElseIf Sheet14.Cells(rngC.Row, 18) = "Reactive" Then
shp.Fill.ForeColor.RGB = RGB(237, 125, 49)
ElseIf Sheet14.Cells(rngC.Row, 18) = "Control" Then
shp.Fill.ForeColor.RGB = RGB(84, 130, 53)
ElseIf Sheet14.Cells(rngC.Row, 18) = "Best Practice" Then
shp.Fill.ForeColor.RGB = RGB(68, 114, 196)
ElseIf Sheet14.Cells(rngC.Row, 18) = "Excellence" Then
shp.Fill.ForeColor.RGB = RGB(255, 255, 0)
End If
Next rngC
End Sub