I have a simple script written that successfully saves the current date in the format I need. I also have saved a destination range in the active sheet. I just need syntax to paste/insert it into that range of cells.

tell application "Microsoft Excel"
    get active workbook
    tell sheet 1
        set ReportDate to do shell script "date '+%d/%m/%Y'"
        set range_value to value of used range
        set firstUnusedCellA to (count range_value)
        set DestinationRange to "G2:G" & (firstUnusedCellA)
        get ReportDate
        paste special on worksheet active sheet destination range DestinationRange

end tell

1 Answer 1


I think the code below speaks for itself. The do shell script command shouldn't be used inside another application tell block. Still I prefer a vanilla AppleScript solution as below which is fine to be used in any context in the script.

tell (current date) to set {_day, _month, _year} to {day, it's month, year}
set _day to text -2 thru -1 of ("00" & _day) -- add leading zeros if needed
set _month to text -2 thru -1 of ("00" & (_month as integer)) -- add leading zeros if needed
set _date to _day & "/" & _month & "/" & _year

tell application "Microsoft Excel"
    tell workbook 1
        tell worksheet 1
            set value of range "$A1:A10" to _date
        end tell
    end tell
end tell
  • I tried it and it results in a error message. "Are you sure you want to do this -today" ?
    – Ruskes
    Apr 1, 2015 at 16:08
  • Thanks for the help dj bazzie wazzie. With your suggested code I was able to get it to work.
    – Gordon
    Apr 1, 2015 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .