how to tell if an excel cell has conditional formatting applied using VBA

yoshiserry picture yoshiserry · Jan 29, 2015 · Viewed 8.1k times · Source

I have a range of cells which have conditional formatting applied.

The aim was to visually separate the values with a positive, negative, and no change.

How can I use VBA to check if the cells have conditional formatting applied to them (such as color of the cell due to being a negative number)?

Answer

Gary's Student picture Gary's Student · Jan 29, 2015

See if the Count is zero or not:

Sub dural()
    MsgBox ActiveCell.FormatConditions.Count
End Sub