MACSCRPT Archives

October 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Paul Berkowitz <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 1 Oct 2009 17:09:41 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (65 lines)
You're asking the wrong question to Excel. You don't actually want the value
of every cell in column 4 of the worksheet: in Excel 2008, worksheets now
have 65,635 rows! That's why you get the spinning beachball - it's going
through all 65,353 cells in column 4.

What you want is just the *filled* cells. That's not difficult at all; the
'used range' property of sheet gets you exactly that, immediately. You don't
have to count the filled rows either, or know in advance how many there are.

    value of column 4 of used range of active sheet

will get what you want immediately.

usually it's a good idea to set a variable to 'used range of active sheet',
since you'll often need to access it many times in the course of a script.

The Excel AppleScript Reference is not as useless as you think. If you read
the introductory section on Working with Ranges, you'd find this same advice
in it, I believe.

-- 
Paul Berkowitz


> From: Bill Steele <[log in to unmask]>
> Reply-To: MACSCRPT <[log in to unmask]>
> Date: Thu, 1 Oct 2009 18:44:41 -0400
> To: MACSCRPT <[log in to unmask]>
> Subject: Get an Excel column
> 
> This ought to be the simplest thing in the world.  I just want to get
> the data in a single column.
> 
> You 'd think
> 
> cells of column 4 of worksheet 1
> 
> or
> 
> get value of column 4 of worksheet 1
> 
> 
> But any Applescript line with "value" and "column" in it  yields the
> spinning beachballl of death, stopped only by force-quitting Excel.
> (Vers. 12.2.0)
> 
> get value of range "D1:D26" of worksheet 1
> 
> works, but I can't find a way for the script to find the number of rows.
> 
> last row of worksheet 1 --> row "$1048576:$1048576" of worksheet 1 of
> active workbook of application "Microsoft Excel"
> 
> How are they counting??
> 
> I've found several tutorials full of helpful information on how to
> create spreadsheets, but nothing about reading one. Microsoft's
> "Applescript Excel Reference" is basically a rehash of the dictionary.
> 
> There must be something absurdly simple that I'm overlooking.
> -- 
> 
> Bill Steele
> [log in to unmask]

ATOM RSS1 RSS2