Home > Uncategorized > Count cells without formulae

Count cells without formulae

August 7th, 2006 Leave a comment Go to comments

If you want to count cells in a given range without formulae use this function

Function CountNoFormula(rng As Range) As Long
Dim c As Range
   On Error GoTo CountNoFormula_Error
    For Each c In rng
        If Not c.HasFormula Then
            CountNoFormula = CountNoFormula + 1
        End If
    Next c
CountNoFormula_CleanUpExit:
   Exit Function
CountNoFormula_Error:
    CountNoFormula = CVErr(Err.Number)
    Resume CountNoFormula_CleanUpExit
End Function

If you want to count cells with formule then just remove then “Not” in front of c.HasFormula

Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.