![]() |
Determine top row and bottom row
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 -- Andrew 090507 |
Determine top row and bottom row
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 "Andrew" wrote in message ... 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 -- Andrew 090507 |
Determine top row and bottom row
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.C ount, 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" wrote: 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 "Andrew" wrote in message ... 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 -- Andrew 090507 |
All times are GMT +1. The time now is 12:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com