• 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: Excel: Append to Range
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Excel: Append to Range


  • Subject: Re: Excel: Append to Range
  • From: Christopher Stone <email@hidden>
  • Date: Thu, 26 Mar 2015 18:20:20 -0500

On Mar 25, 2015, at 01:10, Shane Stanley <email@hidden> wrote:
first column index of firstBlankCell
first row index of firstBlankCell
______________________________________________________________________

Hey Shane,

Thanks.

I was looking for "A" for the first column index instead of 1, although that's easy enough to translate.

You're idea made me go back and search the dictionary for 'column' and I found more or less what I was wanting:

get address local

tell application "Microsoft Excel"
  set aCell to get address local of (get active cell)
end tell

--> "$A$10"

So this is now working like a champ in Microsoft Excel 14.4.8 on OSX 10.9.5.

-------------------------------------------------------------------------------------------
# Retrieve a list of items in a folder.
set fileNameList to list folder alias ((path to home folder as text) & "test_directory:Watch_Folder_Test:") without invisibles

# Convert the list of items to a list of lists.
repeat with a from 1 to length of fileNameList
  set item a of fileNameList to {item a of fileNameList}
end repeat

# Append data to column A of the active worksheet.
tell application "Microsoft Excel"
  tell active sheet of active workbook
    set lastFilledCell to get end (range "A65536") direction toward the top
    if value of lastFilledCell = "" then
      set firstBlankCell to lastFilledCell
    else
      set firstBlankCell to get offset lastFilledCell row offset 1
    end if

    

    set cellAdrsLocal to get address local firstBlankCell

    

    set AppleScript's text item delimiters to "$"
    set {null, _column, _row} to text items of cellAdrsLocal
    set newRange to _column & _row & ":" & _column & (_row + (length of fileNameList) - 1)
    set value of range newRange to fileNameList
  end tell
end tell
-------------------------------------------------------------------------------------------

Thank you to everyone for your assistance.

--
Take Care,
Chris

 _______________________________________________
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: Excel: Append to Range
      • From: Christopher Stone <email@hidden>
References: 
 >Excel: Append to Range (From: Christopher Stone <email@hidden>)
 >Re: Excel: Append to Range (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Excel: Append to Range
  • Next by Date: Re: Best way to script Excel 2016 from Python
  • Previous by thread: Re: Excel: Append to Range
  • Next by thread: Re: Excel: Append to Range
  • Index(es):
    • Date
    • Thread