FWIW, I think most people would argue that given Conditional Formatting is (Super) Volatile (as is the UDF) you are often best served using a Worksheet_Change event to test if the altered (cell(s)) contain a formula or not and formatting the target (cells) accordingly... eg
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngCell As Range
For Each rngCell In Target.Cells
rngCell.Interior.ColorIndex = IIf(rngCell.HasFormula, xlNone, 3)
Next rngCell
End Sub
Or you can make use of the often under utilised SpecialCells(xlCellTypeFormulas) method:
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
.Interior.ColorIndex = 3
.SpecialCells(xlCellTypeFormulas).Interior.ColorIndex = xlNone
End With
End Sub
No need to iterate the above... all cells in the Target range are defaulted to Red and then subsequently any formulae cells present within the range have the background colour removed.
Bookmarks