Condition Formatting - Work Sheet Event Code
Thanks Bill.
Danny
Here it is:
Const WS_RANGE As String = "B11:b40"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Value
Case "excellent": .Interior.ColorIndex = 10
Case "good": .Interior.ColorIndex = 5
Case "fair": .Interior.ColorIndex = 45
Case "fair": .Font.ColorIndex = 45
Case "poor": .Interior.ColorIndex = 9
Case "does not exist": .Interior.ColorIndex = 3
Case "": .Interior.ColorIndex = 2
End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
"Bill Pfister" wrote:
Danny, are you certain that the condition is true (can you step through the
code and watch it hit the ".Font.ColorIndex = 45" portion? Can you posst the
surrounding lines of code?
Regards,
Bill
"Danny" wrote:
I have set up worksheet event code in order to format cells based on text
input.
All works well, but now I would also like the text to match the cell color
in order to hide the text. I have not had any luck getting the font color to
move off black. I am using the following code line: Case "fair":
.Font.ColorIndex = 45
Looking forward to the help!
Danny
|