dougmcc1 said:
A macro wont work for what I want to do because I'd like for the bg
color to change right away instead of running a macro multiple times.
You can have the macro be triggered on every selection change, which is
basically any change in the worksheet. I did something similar with a
macro at the sheet level. You can customize depending on the range of
cells that you need. Here's an example:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo CleanUp:
Application.EnableEvents = False
Dim rCell As Range
For Each rCell In UsedRange ' colorize this range of cells
With rCell
Select Case .Value
Case "G": .Interior.ColorIndex = 4 ' green
Case "B": .Interior.ColorIndex = 8 ' blue
Case "Y": .Interior.ColorIndex = 6 ' yellow
Case "O": .Interior.ColorIndex = 45 ' orange
Case "R": .Interior.ColorIndex = 3 ' red
End Select
End With
Next rCell
CleanUp:
Application.EnableEvents = True
End Sub