You can use the change event with Select Case
Here is a example that use the Change event of the worksheet
Right click on a sheet tab and choose view code.
Paste the event in there and press Alt-Q to go back to Excel.
this will only work in a1:a20
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("a1:a20"), Target) Is Nothing Then
Select Case Target.Value
Case "a"
Target.Interior.ColorIndex = 3
Case "b"
Target.Interior.ColorIndex = 5
Case "c"
Target.Interior.ColorIndex = 8
Case Else
Target.Interior.ColorIndex = xlNone
End Select
End If
End Sub
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl
"Erik" wrote in message ...
Hi,
I am trying to set an array of cells' background colors based on their individual text values. Conditional formatting would
normally work, but I have 10 different colors to assign and the built in conditional formatting only allows three conditions.
Hoping someone could help me with this little project. Thanks.