Applescript. Copy filtered cells in Excel

Discussion in 'Mac Programming' started by Palkan, Jul 2, 2012.

  1. Palkan macrumors newbie

    Jul 2, 2012
    I have a task for Applescript to filter Excel cells based on one criteria "NEW" in column "F" and then copy the filtered cells to a new spreadsheet (new file). I succeeded in filtering the data but now I can't figure out how to copy the result and paste it to the new Excel file. I can not manually define range because the filtered data will be different all the time, so I need automated way to identify the filtered range, select, copy and paste in into new CSV file. Thats what I have so far:

    tell application "Microsoft Excel"
    	set myFile to "Macintosh HD:Users:JustDo:Desktop:AppleScript:Template.xlsx"
    	set new_book to open workbook workbook file name myFile
    	autofilter range range "A1:F1" field "6" criteria1 "NEW" 
    end tell
    Thanks for your help
  2. ender land macrumors 6502a

    Oct 26, 2010
    Is there a reason you want to use AppleScript instead of VBA?
  3. Palkan thread starter macrumors newbie

    Jul 2, 2012
    There is no big reason behind that. At this time I'm just trying to find the best way to perform the task and achieve the result. Maybe VBA would be better, but at this moment I have been playing with AppleScript, thats why I decided to check if it would do that. Ultimately, VBA would work.


Share This Page