Home‎ > ‎Tom's Ideas And Notes‎ > ‎

Excel VBA Reference to Last Cell in table

posted Nov 20, 2013, 11:10 AM by Tom Gutwin   [ updated Nov 20, 2013, 7:20 PM ]
Excel Icon
How many times have I had to loop through rows in an Excel table until I get to the Last Row.  Too Many times and I always forget the quick reference to the row count.
Well here it is as VBA code...
  Dim numRows As Integer
  numRows = ActiveSheet.Columns("A:A").SpecialCells(xlLastCell).Row

See also the MSDN page http://msdn.microsoft.com/en-us/library/office/aa213567%28v=office.11%29.aspx

Use at will!