Hello guys,
Need some help with the below vba.
Instead of highlighting the whole row, I would only like to only highlight certain cells in the row, such as G:V only. Also, need help with the else statement to do nothing instead of removing the conditional formatting in the entire row.
TIA
Here's the code I am working with:
Sub HighlightExp()
Dim lastrow As Long, c As Range
Dim MyRange As Range
lastrow = Cells(Cells.Rows.Count, "BS").End(xlUp).Row
Set MyRange = Range("BS1:BS" & lastrow)
For Each c In MyRange
If UCase(c.Value) = "EXPIRED" Then
c.EntireRow.Interior.Color = vbRed
Else
c.EntireRow.Interior.Color = xlNone
End If
Next
Need some help with the below vba.
Instead of highlighting the whole row, I would only like to only highlight certain cells in the row, such as G:V only. Also, need help with the else statement to do nothing instead of removing the conditional formatting in the entire row.
TIA
Here's the code I am working with:
Sub HighlightExp()
Dim lastrow As Long, c As Range
Dim MyRange As Range
lastrow = Cells(Cells.Rows.Count, "BS").End(xlUp).Row
Set MyRange = Range("BS1:BS" & lastrow)
For Each c In MyRange
If UCase(c.Value) = "EXPIRED" Then
c.EntireRow.Interior.Color = vbRed
Else
c.EntireRow.Interior.Color = xlNone
End If
Next