View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Darren Darren is offline
external usenet poster
 
Posts: 137
Default cell color macro doesn't work

I have this macro that I have been trying to use to change the cell colors of
the cells when the value inside it changes.

Private Sub Worksheet_change(ByVal Target As Range)
If Not Application.Intersect(Range("G4:G17"), Target) Is Nothing Then
If Target.Value 0 Then
Target.Cells.Interior.ColorIndex = 35
ElseIf Target.Value < 0 Then
Target.Cells.Interior.ColorIndex = 38
Else
Target.Cells.Interior.ColorIndex = xlNone
End If
End If
End Sub

I can't understand why it wouldn't work. The only things that I can think
might be affecting it is: 1, the cells are linked to other cells in the sheet
which are linked to an outside program. 2, I don't know if this code
translates to each individual cell color changing as the value changes or if
it wants to change the range when a cell changes . . . anyway, thanks for
any help you can give me.

-DMS