Function CountEmptyCells(iR As Range, Optional iB As Boolean)
Dim iUR As Range
If Not iB Then
CountEmpty = _
iR.Count - Application.CountA(iR)
Else
For Each iUR In iR.Areas
CountEmpty = _
CountEmpty + Application.CountBlank(iUR)
Next
End If
End Function