jacksparrow
New Member
- Joined
- Feb 12, 2008
- Messages
- 35
Hello all,
I have columns of numbers like so:
2
3
I want to setup some code so that the values in D E F would determine the color for the corresponding values in A B C. So if D1 < 10, then A1 = green, if D1 is between 10 and 20, then A1 = red and so on. E1 would likewise determine B1; F3 would determine C3, etc.
I have this code, but I don't know how to alter it to meet the conditions above. Any help would be appreciated.
I have columns of numbers like so:
A B C D E F
1
2
3
I want to setup some code so that the values in D E F would determine the color for the corresponding values in A B C. So if D1 < 10, then A1 = green, if D1 is between 10 and 20, then A1 = red and so on. E1 would likewise determine B1; F3 would determine C3, etc.
I have this code, but I don't know how to alter it to meet the conditions above. Any help would be appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As IntegerIf Not Intersect(Target, Range("A1:A10")) Is Nothing ThenEnd SubSelect Case TargetCase 1 To 5End Selecticolor = 6Case 6 To 10
icolor = 12Case 11 To 15
icolor = 7Case 16 To 20
icolor = 53Case 21 To 25
icolor = 15Case 26 To 30
icolor = 42Case Else
'Whatever
Target.Interior.ColorIndex = icolorEnd If