I need to count the number of blank cells, and cells that contain a number less than 60 in column O. Every time I try CountIf(Range("O:O"), "")
I get a value of 1048539
. I'm expecting way less than that. Am I going about this right? I can count the number of cells that are less than 60 perfectly fine.
The blank sells are set by an equation that makes them equal "" if they don't meet a condition.
I can now find out how many rows my data has, but I still cannot figure out how to count the number of empty cells.
Here is what I am trying.
Sub count()
Dim blanks As Long
Dim totalRows As Long
totalRows = Application.WorksheetFunction.CountA(Range("O:O")) - 1
For i = 1 To totalRows
If (Application.WorksheetFunction.isBlank(Cells(i, "O"))) Then
blanks = blanks + 1
End If
Next i
End Sub
I get the following error
Object doesn't support this property or method
I think it has to do with Cells()
but I'm not sure what else I can use.