View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Carim Carim is offline
external usenet poster
 
Posts: 510
Default change cell colour if value in column = x??

Hi Simon,

Give a try to following :
Private Sub Worksheet_Change(ByVal Target As Range)


Dim Cell As Range
Set Target = Range("D2:D20")
If Target Is Nothing Then
Exit Sub
Else
For Each Cell In Target
If Cell.Value < "" Then
Cell.Offset(0, 18).Range("A1").Interior.ColorIndex = 6
End If
If Cell.Value = "" Then
Cell.Offset(0, 1).Range("A1").Interior.ColorIndex = xlNone
End If
Next Cell
End If
End Sub

HTH
Carim