Hello,

I use the code below to count the empty cells and with a certain fill color.
If I select a few cells the function works, but if i select all the cells i need i get the #VALUE error.
I think this is because my cells have al kinds of format categories like general, text and number.
Does anyone know how i can solve this error?

Tx!

Public Function CountCells(RNG As Range) As Double

For Each CL In RNG
    If IsEmpty(CL) = True Then
        With CL.Interior
            If .Pattern = xlSolid And .Color = 14470546 Then
                CountCells = CountCells + 1
            End If
        End With
    End If
Next CL

End Function