Applescript. Copy filtered cells in Excel

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

  1. macrumors newbie

    Joined:
    Jul 2, 2012
    #1
    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:

    Code:
    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. macrumors 6502a

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

    Joined:
    Jul 2, 2012
    #3
    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.

    Thanks
     

Share This Page