Reputation: 3177
How do I count the number of populated cells (with text/number or combinations of text+number)?
I tried =countif(A2:A2000,1=1)
(with a general criteria, e.g. 1=1 always) but shows zero (0) for a text column.
Upvotes: 2
Views: 108215
Reputation: 276
I think for the answer above, it should rather be
Application.WorksheetFunction.CountA(Range("A2:A2000"))
I have always faced problems while not mentioning Range, cause it considers the whole range to be as a single unit.
Upvotes: 11
Reputation: 77
Dim Coloumncount As Integer Coloumncount = Application.WorksheetFunction.CountA([D1:D100])'count how many filled cell in coloumn "D"
Upvotes: 0
Reputation: 2530
The formula is =COUNTA(A2:A2000)
: non-blank cells are counted.
Upvotes: 5