Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get column or row number of active cell

622 views
Skip to first unread message

mellifera@discussions.microsoft.com Apis mellifera

unread,
Nov 27, 2008, 7:24:01 PM11/27/08
to
Can anyone tell me how to return the row or column index of the active cell
to a variable in AppleScript? I imagine it would look something like this:

set <variable> to first column index of active cell

But this doesn't work. Thanks

JE McGimpsey

unread,
Nov 27, 2008, 10:46:16 PM11/27/08
to
In article <C2F7E750-839D-4A17...@microsoft.com>,

One way:

set a to (get first column index of active cell)

Apis mellifera

unread,
Nov 29, 2008, 1:57:00 AM11/29/08
to

"JE McGimpsey" wrote:

Outstanding! Thanks!

Jamie

unread,
Jan 19, 2010, 2:21:01 AM1/19/10
to

"JE McGimpsey" wrote:
> set a to (get first column index of active cell)

How can I get the same thing but for a row? Would this work?

set a to (get first row index of active cell)

JE McGimpsey

unread,
Jan 19, 2010, 8:32:10 AM1/19/10
to
In article <63B70577-7CE9-49A6...@microsoft.com>,
Jamie <Ja...@discussions.microsoft.com> wrote:

Hmmm...

what happens when you try it?

Jamie

unread,
Jan 19, 2010, 10:20:01 AM1/19/10
to
It doesn't seem to work.

I was trying to use the same concept to get the address information from a
cell divided into column and row information. Here's a snippit of my code
that I've put into a small script to debug. I've tried a whole bunch of
different things and trying to get the dialog to print either mycol2 or
myrow2's addresses fails...

tell application "Microsoft Excel"
activate object worksheet "Sheet1"

(* find first occurance of the word map and call this cell nextmap *)
set nextmap to (find (range "A:A" of worksheet "Sheet1") what "Map")

(*set myrow2 and mycol2 to values take from nextmap address*)
set myrow2 to (get address of row nextmap of Sheet1)
set mycol2 to (get first column index of cell nextmap of Sheet1)
display dialog "myrow2 is set to" & (get address myrow2)

end tell

"JE McGimpsey" wrote:

> .
>

Jamie

unread,
Jan 22, 2010, 4:37:01 PM1/22/10
to
I figured it out. I mixed and match code when really I just need to use your
first suggestion.


(* find first occurance of the word map and call this cell nextmap *)
set nextmap to (find (range "A:A" of worksheet "Sheet1") what "Map")

get address nextmap

set mycol2 to first column index of nextmap
set myrow2 to first row index of nextmap

0 new messages