Conditional Formatting Help!
Another one, in the worksheet module -
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, cell As Range
Dim cIdx As Long, fIdx As Long
On Error GoTo errExit
Set rng = Intersect(Range("A1:CM190"), Target)
If Not rng Is Nothing Then
For Each cell In rng
With cell
Select Case .Value
Case 1: cIdx = 6
Case 2: cIdx = 46
Case 3: cIdx = 37
Case 4: cIdx = 5
Case 5: cIdx = 3
Case Else: cIdx = xlNone
End Select
If cIdx = xlNone Then
fIdx = xlAutomatic
Else
fIdx = cIdx
End If
With .Interior
If .ColorIndex < cIdx Then .ColorIndex = cIdx
End With
With .Font
If .ColorIndex < fIdx Then .ColorIndex = fIdx
End With
End With
Next
End If
Exit Sub
errExit:
End Sub
Regards,
Peter T
wrote in message
...
I need to apply CF macro to my 2003 since I need to have 5
conditions. I know that I can download addins but I am working from a
secure network without internet access.
The range is A1:CM190. Here are my conditions
If the cell value is 1, then the font and internior color index is 6
'yellow'
If the cell value is 2, then the font and internior color index is 46
'Orange'
If the cell value is 3, then the font and internior color index is 37
'blue'
If the cell value is 4, then the font and internior color index is 5
'Dark blue'
If the cell value is 5, then the font and internior color index is 3
'red'
Any help I can get is highly appreciated!!!
Thanks!
|