I know this has been discussed at length in other threads but I did not find the problem I am having.
I have used the code that allows direct entry of a value into a cell which causes the formatting to change, but it does not work when that cell's value is generated by a FORMULA.
Here's the code I use:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("B19:AF25")) Is Nothing Then
Select Case Target
Case 1 To 5
icolor = 5
Case 6 To 10
icolor = 10
Case 11 To 15
icolor = 6
Case 16 To 20
icolor = 3
Case 21 To 25
icolor = 2
Case 26 To 30
icolor = 42
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
The formula is a nested "IF" statement that generates values between the ranges.
Thanks for any help.
I have used the code that allows direct entry of a value into a cell which causes the formatting to change, but it does not work when that cell's value is generated by a FORMULA.
Here's the code I use:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("B19:AF25")) Is Nothing Then
Select Case Target
Case 1 To 5
icolor = 5
Case 6 To 10
icolor = 10
Case 11 To 15
icolor = 6
Case 16 To 20
icolor = 3
Case 21 To 25
icolor = 2
Case 26 To 30
icolor = 42
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
The formula is a nested "IF" statement that generates values between the ranges.
Thanks for any help.