Counting populated rows in excel

  • Thread starter Thread starter noname
  • Start date Start date
N

noname

I have some rows populated in an excel sheet. Is there a way I can writ
a macro to count the number of populated rows
 
Can you pick out a column that's always filled in?

If yes, then maybe you could do this:

Option Explicit
Sub testme()
Dim LastRow As Long
With Worksheets("sheet1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

MsgBox LastRow & " is the last row with data in column A"

End Sub

if there are two rows of headers, just subtract 2.
MsgBox LastRow - 2 & " is the total number of rows"

But there are lots of ways to get the number rows.
 
Back
Top