Good day,
I'm trying to apply conditional formatting to range B2:B500. If the cell value is NOT equal to "A" and If the cell is NOT blank, apply a gray interior (color index 15).
The below works, but only for the used range within the specified range. So if user subsequently adds data to one of the blank cells, the conditional formatting is not applied.
Can anyone help modify this so the conditional formatting will also be applied based on any new data the user enters into the blank cells?
I've been playing around with only applying the formatting if the value is not equal to "A" and if cell length is not equal to 0 (instead of blank)... but no luck yet.
Appreciate any help.
I'm trying to apply conditional formatting to range B2:B500. If the cell value is NOT equal to "A" and If the cell is NOT blank, apply a gray interior (color index 15).
The below works, but only for the used range within the specified range. So if user subsequently adds data to one of the blank cells, the conditional formatting is not applied.
Can anyone help modify this so the conditional formatting will also be applied based on any new data the user enters into the blank cells?
I've been playing around with only applying the formatting if the value is not equal to "A" and if cell length is not equal to 0 (instead of blank)... but no luck yet.
Appreciate any help.
VBA Code:
Sub applyCF
Dim cond As FormatCondition
Dim rng As Range
Dim ws As worksheet
Set rng = ws.Range("B2:B500").SpecialCells(xlCellTypeConstants)
Set cond = rng.FormatConditions.Add(xlCellValue, xlNotEqual, "A")
With cond
.Interior.ColorIndex = 15
End With
End Sub