• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Excel Last Cell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Excel Last Cell


  • Subject: Excel Last Cell
  • From: Don Rossi <email@hidden>
  • Date: Wed, 13 Dec 2000 14:40:01 -0500

This is not a pretty solution but it works and I can not take full credit or
blame. It is a technical I saw used for a similar problem over a year ago.
There is a verb in the Excel dictionary "UsedRange" that returns the
information you seek but IMVHO in a completely useless form. By trying to
coerce to text you receive an error message containing the entire range.
Capture this in a try block and parse out the range. I use a regular
expression addition but text item delimiters will also work.

(* This just defines my regular expression*)
set regEx to compile regular expression
"[R]([0-9]*)[C]([0-9]*)[:][R]([0-9]*)[C]([0-9]*)"

tell application "Microsoft Excel"
set the wholeSheet to UsedRange of Worksheet 1

try
set tryThis to wholeSheet as text -- this will fail

on error errmessage
(* here is where you capture to info you seek *)
set theRange to match regular expression regEx to errmessage
set finalRow to match 3 of parseRange
end try

end tell

I hope a better solution comes out of your question, but the real problem
is the ugly thing Microsoft has done with this dictionary. One part of me
is thankful to have Excel scriptable but jeez this thing does not "work and
play well with others"!

hope it is some help
Don Rossi


  • Prev by Date: Re: Newbie FaceSpan/Applescript question
  • Next by Date: Re: "List View" ASIP Please!
  • Previous by thread: Re: Excel last cell
  • Next by thread: Re: Excel Last Cell
  • Index(es):
    • Date
    • Thread