Re: Canonical way to extract row number from a cell reference
Re: Canonical way to extract row number from a cell reference
- Subject: Re: Canonical way to extract row number from a cell reference
- From: Axel Luttgens <email@hidden>
- Date: Sat, 15 Mar 2014 10:52:42 +0100
Le 15 mars 2014 à 06:34, Alastair Leith a écrit :
> tell application "Microsoft Excel"
> set ac to get address of active cell
> set rw to last word of ac #win ugly
> log ("Active cell: " & ac & return & "Row from Active Cell: " & rw)
> end tell
>
>
> Is there a less ugly way to pull the column or row number from a cell reference than using words as per line 3.
Hello Alastair,
You're probably looking for this one:
set rw to first column index of active cell
> Also how can one construct a cell reference programatically to columns (rows are easy because they are integer values?
>
> set col to column (1)
> set col1 to get address of col
> set col2 to second word of col1
> set rw to 54
> set r to range (col2 & rw)
> log value of r
>
> Is there a cleaner way to turn a integer into a column reference than above?
Let's say you're interested in cell at third row and fourth column (in your example, this was cell at row 54 and column 1); all of these seem to be valid ways to refer to that cell:
row 3 of column 4
column 4 of row 3
cell 3 of column 4
cell 4 of row 3
Now, if you want a range object, command "get offset" may be applied to each of the above; for example:
get offset row 3 of column 4
Another way to get that range is to start with the sheet's top-left cell:
get offset cell "A1" row offset 3 column offset 4
And so on...
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden