Try the =counta() function.
This is a discussion on Number of Rows In Worksheet within the Excel Questions forums, part of the Question Forums category; I need to count how many rows I have in my worksheet (rows with actual info). Does anyone know how ...
I need to count how many rows I have in my worksheet (rows with actual info). Does anyone know how to do this?
In VBA code?
Try the =counta() function.Originally Posted by sarahe
Among many other possibilities.
If you assume column A has data for each row that you want to count:
NumRows = Application.WorksheetFunction.CountA(Range("A1:A65536"))
asumming you have data in cloumn 1, one way to do it is:
Dim lastrow as single
lastrow = range("a65536").end(xlup).row