Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default accessing last cell in selection on sheet

In VBA it would be

Selection.Item(selection.Count)

from the immediate window:

? selection.Address
$C$6:$F$16
? selection.Item(selection.count).Address
$F$16


for a single range/area, the selection or range will always be left to right
and top to bottom, regardless of how the user made the selection.

--
Regards,
Tom Ogilvy


"gnosis" wrote in message
...

Sorry if i was not clear..I'm talking about a single selection, with
only one stroke, one rectangle...
actually i'm woking on delphi application and i use a XLSContainer
component with all objects,methods and properties from
EXCEL-VBA...XLSContainer displays some EXCEL file that is loaded on
FormShow...
.finnaly i need to access all the cells from a single selection made
by a client(by some buttonclick-event or whatever) and put the values
from the cells in a database..
So far i manage to get the number of columns and rows in the selection
by these methods:
XLSContainer1.Application.ActiveWindow.RangeSelect ion.Columns.Count
XLSContainer1.Application.ActiveWindow.RangeSelect ion.Rows.Count

and coordinates of the first cell in the selection
XLSContainer1.Application.ActiveCell.Column
XLSContainer1.Application.ActiveCell.Row

the problem is that i cannot predict the direction of the selection:
there are four possibilities:
- to select from left to right,up to down
- to select from rigt to left, up to down
- to select from left to right, down to up
- to select from right to left, down to up
if i could get the coordinates of the most distant cell from the first
activCell in the selection i will know about the direction of the
movement of the client.
I can get these values in VB editor with some
VB macro like
If TypeName(Selection) < "Range" Then Exit Sub
For Each cell In Selection

cell.Activate
..some code
Next cell
but it's usles in delphi
if anybody have an idea i would be greatfull
Thanx so far!!!


--
gnosis
------------------------------------------------------------------------
gnosis's Profile:

http://www.excelforum.com/member.php...o&userid=16806
View this thread: http://www.excelforum.com/showthread...hreadid=320055



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
Excel sheet: selection of cell or rows not visible. Hisoul Excel Worksheet Functions 2 May 16th 07 09:06 PM
Problem seeing and accessing top of sheet egii Excel Discussion (Misc queries) 1 January 11th 07 02:52 AM
Cell selection in non-active sheet Otto Moehrbach[_6_] Excel Programming 1 July 16th 04 05:16 PM
Capture listbox selection to a cell in a different sheet Marcie Excel Programming 2 September 19th 03 12:15 PM
Accessing a textbox on a sheet.... Cyril[_2_] Excel Programming 1 August 11th 03 06:37 PM


All times are GMT +1. The time now is 05:35 PM.

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

About Us

"It's about Microsoft Excel"