• 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
Re: AS and Excel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AS and Excel


  • Subject: Re: AS and Excel
  • From: "koenig.yvan" <email@hidden>
  • Date: Wed, 21 Aug 2013 17:04:09 +0200


Le 21/08/2013 à 14:02, Willard L. McMunn <email@hidden> a écrit :

Try this:

tell application "Microsoft Excel"
tell active workbook
tell active sheet
set theLastRow to first row index of (last cell of used range)
tell range ("A1:A" & theLastRow)
set theResult to string value of every cell
repeat with jItem from 1 to count theResult
if item jItem of theResult = "" then
set item jItem of theResult to false
end if
end repeat
set theResult to strings of theResult
end tell
end tell
end tell
end tell


Thanks
but

(1) what need for range ("A1:A" & theLastRow)
when range ("A:A")
is supposed to behave the same ?

(2) As I wrote in an other message, dropping the content of empy cells is asked because I am curious.
Using a loop is a trivial soluce.
I am in search of a more elegant one.
From my point of view, the whose filter was the perfect one but it's not available in XL.
It's why I asked twice if :

# these two instructions aren't speaking to Excel so there is no need to put them in the tell block
set testFile to choose file "PLease select the Excel Workbook!"
set fileName to testFile as string
tell application "Microsoft Excel"
set newWorkbook to open workbook workbook file name fileName
tell sheet 1 of newWorkbook
# the cell B1 is supposed to be empty
set theRange to (column difference range ("A:A") comparison range "B1")
set theResult to (value of theRange)
end tell
end tell
is behaving flawlessly.
This code is based upon what was already posted here and what I read in Excel2004 AppleScript Ref.pdf

The problem is that I can't test it.

KOENIG Yvan (VALLAURIS, France) mercredi 21 août 2013 16:59:58




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

This email sent to email@hidden

  • Follow-Ups:
    • Re: AS and Excel
      • From: Thomas Fischer <email@hidden>
    • Re: AS and Excel
      • From: Bruce Robertson <email@hidden>
References: 
 >Re: AS and Excel (From: "Willard L. McMunn" <email@hidden>)

  • Prev by Date: Re: AS and Excel
  • Next by Date: Re: AS and Excel
  • Previous by thread: Re: AS and Excel
  • Next by thread: Re: AS and Excel
  • Index(es):
    • Date
    • Thread