Logical test if cell uses formatting..

J

John Bundy

As far as I know there is nothing built in, I built this function for someone
that counts cells that are bold, you can use it or modify, I can help you
modify it to your purpose if you need to. It goes in a module, preferably in
your personal.xls.

Function CountBold(rRange As Range) As Long
Dim lCount As Long, myCell As Range
lCount = 0
For Each myCell In rRange
If myCell.Font.bold = True Then
lCount = lCount + 1
End If
Next myCell
CountBold = lCount
End Function
 
J

JE McGimpsey

Note that changing the formatting within rRange doesn't cause this to
recalculate. You could add

Application.Volatile

after the Dim statement, but you'd still need to manually calculate the
sheet to ensure that the result is correct.
 
Top