D
Doo0592
Hi all,
I am trying to create a spreadsheet that will highlight certain
conditions when they match. So far I have what is below. I need to add
another case that will highlight the row when a date passes (ie,
todays()). I would like it to highlight interior red with white bold
font. And how do i get this code to act on multiple rows?
Any help appreciated
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "L3"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B3:X3")) Is Nothing Then
With Target
Select Case .Value
Case "condition 1": Range("B3:X3").Interior.ColorIndex
= 15
Case "condition 2": Range("B3:X3").Interior.ColorIndex
= 35
Case "", "condition3":
Range("B3:X3").Interior.ColorIndex = 0
Case "condition 4": Range("B3:X3").Interior.ColorIndex
= 0
Case "condition 5": Range("B3:X3").Interior.ColorIndex
= 0
End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
I am trying to create a spreadsheet that will highlight certain
conditions when they match. So far I have what is below. I need to add
another case that will highlight the row when a date passes (ie,
todays()). I would like it to highlight interior red with white bold
font. And how do i get this code to act on multiple rows?
Any help appreciated
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "L3"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B3:X3")) Is Nothing Then
With Target
Select Case .Value
Case "condition 1": Range("B3:X3").Interior.ColorIndex
= 15
Case "condition 2": Range("B3:X3").Interior.ColorIndex
= 35
Case "", "condition3":
Range("B3:X3").Interior.ColorIndex = 0
Case "condition 4": Range("B3:X3").Interior.ColorIndex
= 0
Case "condition 5": Range("B3:X3").Interior.ColorIndex
= 0
End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub