Need number of rows

A

alsameer

Is there any function which can return the number of rows present in th
specified sheet.

I remember I have seen one function for this befor somewhere. But no
able to recollect :confused:

thank
 
D

David McRitchie

The question is somewhat ambiguous.
The number or rows in a spreadsheet is dependent on your version
of Excel. What are you looking for and how do you want to use it.

Ctrl+End will take you to the lastcell location which is the intersection
of the last used row an the last used column, but it is more like a high
water mark than a correct location. Some more insight into this can
be found at http://www.mvps.org/dmcritchie/excel/lastcell.htm
 
A

alsameer

thanks David.
I got it. "ActiveSheet.UsedRange.Rows.Count"
ur links were really helpful. :)
 
D

David McRitchie

Just to make sure that you are working with what you think you
will be working with -- if you start with an empty sheet so that the
lastrow count will not be messed up and populate cells B3:D4
you will get the following results (nothing is in the first two rows):

ActiveSheet.UsedRange.Rows.Count is 2
Cells.SpecialCells(xlLastCell).Row is 4
ActiveSheet.UsedRange.Address is $B$3:$D$4
 

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

Top