There are some issues in the AppleScript implementation that can affect ranges if you refer to them as row, column, or cell in your scripts rather than as range. For more information about issues with columns and rows, see Known issues in Excel 2004.
Ranges are the basis for most manipulation of Microsoft Excel using Visual Basic for Applications (VBA) and AppleScript. Note that ranges are child objects of worksheet, and so cannot contain cells in multiple worksheets.
Note that AppleScript refers to ranges by address in
A1
format as it does "by name" in other applications. That is, the keyword range is followed directly, after a space, by the address in quotes, without the parentheses that VBA uses:
Range("A1:J10")range "A1:J10"
There's one minor issue to be aware of. Most people have discovered, in both VBA and AppleScript, that if they write simply
Range("A1:J10")
in VBA, or
range "A1:J10"
or
cell "A1"
in AppleScript without specifying any sheet, Excel
defaults to the active sheet.
However, if you refer to used range:
set ur to used range
or
cell 3 of row 4 of (get used range)
without specifying
of
active sheet, no result is returned and the next line of the script that references the result errors.
It is always a best practice, in any case, to target the sheet, perhaps via
tell active
sheet
around as much of the script as needs it (just as you write
With ActiveSheet
in VBA). If you are in the habit of omitting the active sheet property, you will hit perplexing errors when you need to access the used range property, as happens in a great many scripts. So it's best not to get into that particular habit.


