View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Conditional Format

As you want more than 3 conditions you need VBA

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:A6")) Is Nothing Then
With Target
Select Case LCase(.Value)
Case "dog": .Offset(0, 1).Resize(1, 10).Interior.ColorIndex
= 3
Case "cat": .Offset(0, 1).Resize(1, 10).Interior.ColorIndex
= 5
Case "fish": .Offset(0, 1).Resize(1, 10).Interior.ColorIndex
= 10
Case "bird": .Offset(0, 1).Resize(1, 10).Interior.ColorIndex
= 19
Case "horse": .Offset(0, 1).Resize(1,
10).Interior.ColorIndex = 20
Case "snake": .Offset(0, 1).Resize(1,
10).Interior.ColorIndex = 34
End Select
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.



Haven't checked the colours
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ME" wrote in message
...
Reposted and condensed from post in Worksheet functions.....
A1:A6 can equal dog,cat,fish,bird,horse,snake. I want to conditionally

format B1:K6 based on the A1:A6 value. I want a different color for the row
dependent on the entry in Column A.

DogRow is Red, CatRow is Blue , FishRow is Green, BirdRow is Yellow,

etc.

How do I do this?
Thanks!
Michael E