PC Review


Reply
Thread Tools Rate Thread

Determine top row and bottom row

 
 
=?Utf-8?B?QW5kcmV3?=
Guest
Posts: n/a
 
      9th May 2007
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 With Quote
 
 
 
 
Tim
Guest
Posts: n/a
 
      9th May 2007
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" <(E-Mail Removed)> wrote in message
news:5685D99C-E40B-4C21-847E-(E-Mail Removed)...
> 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 With Quote
 
=?Utf-8?B?QW5kcmV3?=
Guest
Posts: n/a
 
      9th May 2007

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" 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" <(E-Mail Removed)> wrote in message
> news:5685D99C-E40B-4C21-847E-(E-Mail Removed)...
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert page numbers, odd on bottom right,even on bottom left George A. Microsoft Word New Users 5 17th Oct 2009 01:32 PM
determine whether the activecell is on the top or bottom John Smith Microsoft Excel Programming 3 31st Aug 2009 02:29 AM
dislike jump bottom of column by double-clicking the bottom of cel =?Utf-8?B?Sm9l?= Microsoft Excel Misc 1 9th Apr 2006 09:27 PM
toolbar/taskbar (start bar) location it is somehow on the side and not the bottom and wont drag back to the bottom howrmk Marquita O'Riley Windows XP General 4 23rd Jul 2005 11:47 AM
how to paste data from top to bottom to bottom to top =?Utf-8?B?RmF6ZWVs?= Microsoft Excel Misc 1 25th Jan 2005 12:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:47 AM.