VBA : get number of rows in a spreadsheet

  • Thread starter Thread starter Bill Dallas
  • Start date Start date
B

Bill Dallas

Is there any way in VBA that I can find the number of rows used on a
spreadsheet (the active worksheet)? The reason I need this is because
I am trying to add some extra lines to a sheet (and move the following
rows down the sheet).

Cheers
Bill Dallas
 
Bill,

Dim myRow As Long

myRow = Range("A1").SpecialCells(xlCellTypeLastCell).Row

The above will often report more rows than those actually used, so often it
is better to check a specific column for the last entry:

myRow = Range("A65536").End(xlUp).Row

HTH,
Bernie
MS Excel MVP
 
Back
Top