Finding row number at the bottom of a block of data

  • Thread starter Thread starter Andreww
  • Start date Start date
A

Andreww

Hi - Essentially I need to find how many records in a worksheet.

I can do

Sub test1()
Sheets("Data").Select
Range("A1").Select
Selection.End(xlDown).Select
End Sub

Which taked me to the end of the block of data, but how do I:

a) Find the rownumber the curser stopped at?
b) put the cell address into a cell on a refernce sheet?

Any ideas?

Thanks

Andrew
 
To avoid stopping at a gap in the data it's usually better to start at the bottom....

dim r as range

set r=sheet1.cells(sheet1.rows.count,1).end(xlup)

then you can use

r.row
r.address
 

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