VP CODE
Here is an example with just 3 colours but it can easily be extended by
extra case statements
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
Select Case LCase(.Value)
Case "red": .Interior.ColorIndex = 3
Case "blue": .Interior.ColorIndex = 5
Case "green": .Interior.ColorIndex = 10
'etc
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"JLP" wrote in message
...
Since CF only lets you have 3 formats per cell can someone write how to
put it in code to have 10 different backround shadings based on certain text
names in a group of cells. Also what are all the options in the worksheet
section? Which one do I write the code under? Will this then work
automatically for me?
Can you email me with a file that will do this?
|