Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In a user selected single column selection, how do I determine
whether the activecell is on the top or bottom of the selection? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just to you know, the ActiveCell can be located interior to the Selection
(make a Selection and then press the Tab key a few times). Given that, here is some code you can use... Location = InStr(Selection.Address, ActiveCell.Address) If Location = 0 Then MsgBox "ActiveCell is not at either end of the Selection" ElseIf Location = 1 Then MsgBox "ActiveCell is at the beginning of the Selection" Else MsgBox "ActiveCell is at the end of the Selection" End If -- Rick (MVP - Excel) "John Smith" wrote in message ... In a user selected single column selection, how do I determine whether the activecell is on the top or bottom of the selection? Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could compare rows:
Dim myRng as range dim myCell as range set myrng = selection.areas(1) 'or something specific??? set mycell = activecell 'or anything you want. msgbox myrng.row & vblf & myrng.rows(myrng.rows.count).row & vblf & mycell.row John Smith wrote: In a user selected single column selection, how do I determine whether the activecell is on the top or bottom of the selection? Thanks. -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I guess I should mention that my code assumes the selection is contiguous.
If it is not contiguous, then you will have to tell us what the beginning and end of the selection means as the selection is constructed in the order the cell or cells are added to it... that means the first and/or last selected area could be between what looks like outer areas. For example, select these areas in the order shown (hold down the Control key while selecting them)... B2:C5, then A7:C9, then E1:G4 and then E6:F8. Now execute this line in the Immediate Window... ? Selection.Address and note the order the addresses are printed in... it's the same order you selected them in. So, which to you consider the first area and which is the last? Before you answer too quickly, note the top left area is does not have the leftmost nor topmost cell in it; nor does the bottom right one contain the rightmost or bottommost cell -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... Just to you know, the ActiveCell can be located interior to the Selection (make a Selection and then press the Tab key a few times). Given that, here is some code you can use... Location = InStr(Selection.Address, ActiveCell.Address) If Location = 0 Then MsgBox "ActiveCell is not at either end of the Selection" ElseIf Location = 1 Then MsgBox "ActiveCell is at the beginning of the Selection" Else MsgBox "ActiveCell is at the end of the Selection" End If -- Rick (MVP - Excel) "John Smith" wrote in message ... In a user selected single column selection, how do I determine whether the activecell is on the top or bottom of the selection? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
determine if activecell in specific worksheet and column | Excel Programming | |||
determine activecell and move to it after running ohter sub... | Excel Programming | |||
If activecell.column = variable then activecell,offset (0,1) | Excel Discussion (Misc queries) | |||
Determine top row and bottom row | Excel Programming | |||
dislike jump bottom of column by double-clicking the bottom of cel | Excel Discussion (Misc queries) |