View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BeSmart BeSmart is offline
external usenet poster
 
Posts: 102
Default Need help to changes a conditional formatting code....

How do I change this code to first apply the "If" to data in the cell across
in Column E of the current row (eg RC5), if it's true and the value in the
current cell is greater than 0 then apply the formatting?
Thanks in Advance
BeSmart

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Value = "Cat" Then
Target.Cells.Interior.ColorIndex = 1
ElseIf Target.Value = "Dog" Then
Target.Cells.Interior.ColorIndex = 4
ElseIf Target.Value = "Horse" Then
Target.Cells.Interior.ColorIndex = 5
ElseIf Target.Value = "Camel" Then
Target.Cells.Interior.ColorIndex = 6
ElseIf Target.Value = "Pig" Then
Target.Cells.Interior.ColorIndex = 7
Else
Target.Cells.Interior.ColorIndex = xlnone
End If

End Sub