AppleScript for Excel to select/copy all cells

applescriptms office

Applescript can tell Excel to select a specific range of cells, e.g.

select (range "A1:B20")

and you can copy cells:

copy (range "A1:B20")

However, how can you tell Excel to select all the cells in a worksheet, or to copy all the cells in a worksheet? It seems to require a specific range. However, of course, when you are working with Excel directly you can just press cmd+A to select all.

Best Answer

found this on Macscripter.net I think it is what you are looking for:

tell application "Microsoft Excel"
   tell active sheet
       select used range
   end tell
end tell