View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] hamblin.adam@gmail.com is offline
external usenet poster
 
Posts: 6
Default Worksheet change doesn't work completely

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

I've got this function for each cell in the range "n7:is66"....

=IF(AND(N$2=$K7,N$2<=$L7),IF($G7="On Track",2,IF($G7="Issues",
3,IF($G7="At Risk",4,IF($G7="Completed",5,1)))),"")

and because conditional formating is too limited, I've got the below
VBA changing the colors when $G7 through $G66 changes, it works fine
when g7 is changed, but in order for the cells in n7:is66 to chang
color, I have to click each one individually in order for them to
change to their new color. So, how can these cells change color
everytime colomn G on their row changes automatically?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target, Range("n7:is66")) Is Nothing Then
Select Case Target
Case 1
icolor = 41
Case 2
icolor = 10
Case 3
icolor = 6
Case 4
icolor = 3
Case 5
icolor = 1
Case Else
'whatever
End Select
End If
Target.Interior.ColorIndex = icolor

End Sub