Hi there,
I am trying to count the number of blank cells in a column.
So far I have:
Sub findrange()
Dim lastrow As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Range("h12") = Application.WorksheetFunction.CountBlank(Range("B2" & lastrow))
However this gives me an incorrect figure. The lastrow reference in the last line is where i think the problem is, but on its own it correctly selects the last cell in column B, so im not sure why the reference is wrong.
Any help would be appreciated.
I am trying to count the number of blank cells in a column.
So far I have:
Sub findrange()
Dim lastrow As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Range("h12") = Application.WorksheetFunction.CountBlank(Range("B2" & lastrow))
However this gives me an incorrect figure. The lastrow reference in the last line is where i think the problem is, but on its own it correctly selects the last cell in column B, so im not sure why the reference is wrong.
Any help would be appreciated.