Determine top row and bottom row

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Probably an easy for some but....

Can someone please tell me the code to identify the top row and the bottom
row if the user clicks on rows 5 and drags to row 10?

Thanks
 
Do you mean the start and end rows of the selected area ?

selection.cells(1).row
selection.cells(selection.cells.count).row

Assuming it's not a multi-area selection.

Tim
 
Thanks Tim,

While waiting I found some code and adapted it as follow.

Dim LastRow As Long
Dim LastCol As Long
Dim N As Long
N = Selection.Areas.Count
Last_Row = Selection.Areas(N).Cells(Selection.Areas(N).Rows.Count, 1).Row
No_Rows = Selection.Areas(N).Rows.Count
First_Row = Last_Row - No_Rows + 1



I just finished when I got your reply. Thanks anyway

--
Andrew


Tim said:
Do you mean the start and end rows of the selected area ?

selection.cells(1).row
selection.cells(selection.cells.count).row

Assuming it's not a multi-area selection.

Tim
 

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