Re: Need help: Really silly Excel 2004 question
Re: Need help: Really silly Excel 2004 question
- Subject: Re: Need help: Really silly Excel 2004 question
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 13 Oct 2004 08:46:09 -0700
On 10/13/04 3:53 AM, "Richard Rönnbäck" <email@hidden>
wrote:
> I need to get the names of used cell in an Excel sheet, like "A1", "C5" etc
>
> I can refer to a cell with such strings if I set it's value, but I cant
> figure out how to get that value in return from a cell, neither from the
> dictionary or in any of the properties I get in return if I run:
>
> tell application "Microsoft Excel"
> set myUsedRange to used range of sheet 1 of workbook 1
> return properties of cell 1 of myUsedRange
> end
>
> The cell has a range, but I can't figure out how to coerce an Excel range to
> string either, so I can't filter the string either.
>
> I could of course check for first column and row index, but I figure there
> must be a better way.
Assuming this is Excel 2004 since there aren't any uppercase characters
(don't people know the dictionary was completely changed for Word and Excel
2004? Please always state the version you're using), check out 'get
address' in the Table Suite. There are still a number of things that we'd
all prefer to be properties of a class which are instead specific commands.
tell application "Microsoft Excel"
set myUsedRange to used range of sheet 1 of workbook 1
get address (cell 1 of myUsedRange)
end tell
--> "$A$1"
That's the "absolute" reference (with the "$" signs) which is almost always
what you want. If you want the relative reference (say, the used range
doesn't begin in A1 but you want the top left corner to be referred to as A1
anyway). you'd use
get address (cell 1 of myUsedRange) without column absolute and row
absolute
--> "A1"
You can also still get the old-fashioned R1C1 type references, even though
Excel 2004 AppleScript no longer uses those when calling ranges:
get address (cell 1 of myUsedRange) reference style R1C1
--> "R1C1"
--
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:
This email sent to email@hidden