You can insert blank cells into a range using the insert into range command, which is the equivalent of the Visual Basic for Applications (VBA) Insert method, as long as there is room to do so without moving populated cells off of the worksheet. It is just like the Insert > Rows, Columns, or Cells menu in the UI. In VBA:
Sheets("Sheet1").Range("B2:B5").Insert Shift:=xlShiftToRightIn AppleScript:
insert into range range "B2:B5" shift shift to right
In VBA, if a range has been copied and the Insert method applies to a range of the same size, the clipboard contents will be copied to the inserted cell.
With ActiveWorkbook
With Sheets("Sheet2").Range("A1:A10")
.Copy
Sheets("Sheet1").Range("B2").Resize( _
.rows.count, .columns.count).Insert _
Shift:=xlShiftToRight, _
CopyOrigin:=xlFormatFromLeftOrAbove
End With
End WithHere the CopyOrigin argument in VBA has no AppleScript equivalent, so the defaults will rule. If this argument is omitted, the format is inherited as from the Left or Above depending on whether the shift was to the right or down. So there's no way to specify it in AppleScript, but in this case the result will be exactly the same — xlFormatFromLeftOrAbove.
tell application "Microsoft Excel" tell active workbook tell range "A1:A10" of sheet "Sheet2" copy range insert into range (get resize row size (count rows) ¬ column size (count columns)) shift ¬ shift to right end tell end tell end tell


