Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Excel Selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Excel Selection



On 10/30/06 12:39 PM, "Steven Valenti" <email@hidden> wrote:

> I want to get the row and column of selected cell or cells. If I use
> this code...
> set MySelection to selection
> ...I get
> --selection of Application "Microsoft Excel" as a result
> Dictionary states the selection returns a Range but I was expecting
> something like "A3" or whatever was selected.
> Is there anyway to return the row and column value of a selection?

Yes, look up 'range' in the dictionary, and also read the introductory
section of the Excel AppleScript Reference (free download from
www.microsoft.com/mac/ , go to Resources/Developers/AppleScript) which is
all about working with ranges.

Most objects are (as is frequent with AppleScript) passed as references
rather than being evaluated. That has its advantages: if you want to modify
the selection, you can. It is a little annoying sometimes that it doesn't
evaluate to the range-by-address (i.e. range "A10:A15" of worksheet "Name"
of workbook "File Name.xls"), but you can manipulate it exactly as if it
did.

Try

    properties of selection

and you'll see you get all of them. You can pick and choose whichever
property you want to return. Or you can apply a command to it. (In this case
you don't even have to get it as a variable first nor use the explicit
'get'):

    get address selection
    --> "$A$10:$A$15"

('get address' is an Excel command - it's not the explicit 'get' there
either.)

--
Paul Berkowitz


 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Excel Selection (From: Steven Valenti <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.