MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VB rowcount


Posted by Luke Adams on June 20, 2001 7:47 AM

I am writing code in Visual Basic to control Excel. How do I count the number rows with data in. (The row number after which there is no data in any of the rows).


Posted by mseyf on June 20, 2001 10:57 AM

confused by your question.

do you want the number of rows containing data:

Application.ActiveSheet.UsedRange.Rows.Count

or the row number of the first blank row:

Range("a65536").End(xlUp).Row + 1

HTH

-Mark

Posted by mseyf on June 20, 2001 11:55 AM

or probably better:

Range("a65536").End(xlUp).Offset(1, 0).Row