Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Top 5 vs Bottom 5 Chad Portman Excel Discussion (Misc queries) 1 September 21st 09 03:52 AM
Top 10% and Bottom 10% Joshann Excel Worksheet Functions 2 May 30th 06 02:05 PM
dislike jump bottom of column by double-clicking the bottom of cel Joe Excel Discussion (Misc queries) 1 April 9th 06 09:27 PM
how to paste data from top to bottom to bottom to top Dave Peterson Excel Discussion (Misc queries) 0 January 25th 05 12:12 AM
bottom row Mike Archer[_2_] Excel Programming 2 May 13th 04 11:37 AM


All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"