使用applescript在Excel中选择多个列

时间:2013-01-08 22:19:03

标签: applescript

我正在尝试用AppleScript教我自己需要AppleScript的东西。

(我知道必须有重复的东西的快捷方式,但是我找不到关于如何做到这一点的好教程,所以我做了很长的路。)

我一直坚持如何选择多个列(或行)。我想选择填充的列并对它们进行排序,但我不能,因为我不知道如何选择多列。任何指导都将非常感谢。

我希望脚本能做的是:

  • 打开Excel文件
  • 删除第1-32行
  • 删除第4-7列
  • 删除新列7
  • 选择列1-5
  • 按列排序1-5,首先按任务排序,然后按样本
  • 排序
  • 删除包含ENDO
  • 的行
  • 保存文件

这是我到目前为止所做的:

tell application "Microsoft Excel"
activate
open (choose file)
end tell

tell application "Microsoft Excel"
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete row 1
    delete column 4
    delete column 4
    delete column 4
    delete column 4
    delete column 7
    select row 1
    select row 2
end tell

1 个答案:

答案 0 :(得分:2)

这应该让你开始:Excel 2004 AppleScript Reference

tell application "Microsoft Excel"
    tell active sheet of active workbook
        set myRows to range "1:27"
        delete myRows
        set myColumn to range "D:G"
        delete myColumn
    end tell
end tell