akparasite
Board Regular
- Joined
- Jul 15, 2002
- Messages
- 55
I'm not a VBA expert, so I need a little guidance...
I've got all three default conditional format options loaded up in my worksheet, and I need to have a fourth available based upon whether a value is associated with a particular record. I've seen Dave Hawley's code for getting around the conditional format limit (see below), but I need to incorporate an IF/THEN statement that applies the formula I need with the fourth conditional format condition. I know this is probably REAL simple, but I'm not tuned into VBA enough to dial-in the structure. Any good ideas? Thanks!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:A10")) is Nothing Then
Select Case Target
Case 1 To 5
icolor = 6
Case 6 To 10
icolor = 12
Case 11 To 15
icolor = 7
Case 16 To 20
icolor = 53
Case 21 To 25
icolor = 15
Case 26 To 30
icolor = 42
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
I've got all three default conditional format options loaded up in my worksheet, and I need to have a fourth available based upon whether a value is associated with a particular record. I've seen Dave Hawley's code for getting around the conditional format limit (see below), but I need to incorporate an IF/THEN statement that applies the formula I need with the fourth conditional format condition. I know this is probably REAL simple, but I'm not tuned into VBA enough to dial-in the structure. Any good ideas? Thanks!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:A10")) is Nothing Then
Select Case Target
Case 1 To 5
icolor = 6
Case 6 To 10
icolor = 12
Case 11 To 15
icolor = 7
Case 16 To 20
icolor = 53
Case 21 To 25
icolor = 15
Case 26 To 30
icolor = 42
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub