Returning max number of rows

  • Thread starter Thread starter Peter Bernadyne
  • Start date Start date
P

Peter Bernadyne

I'm trying to return the maximum number of rows used in a worksheet.
can run a loop each time to count however many cells I have populated
but this takes too long.

Isn't there a shortcut for this that I can use in my macro?

I thought I should be using Rows.Count but that gives me 65536 eac
time, not the actual number of rows I have populated on my worksheets.

Any help greatly appreciated!

-Pete
 
Hi
to get the last row of a column try

Dim lastrow as long
lastrow = activesheet.Cells(Rows.Count, "A").End(xlUp).Row
 
Thank you very much for your kind help.

I used this and it worked just fine. I can only hope I might be abl
to return the favor one day.

All the best,

-Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top