在Excel工作簿中的所有工作表上迭代Applescript

时间:2012-12-14 13:16:09

标签: excel applescript automator

我已经做了一些搜索,但似乎无法找到如何让我的Applescript迭代Excel工作簿中的每个工作表。目前我只是告诉脚本无限重复并手动点击表格,这是不理想的!

这就是我想要为工作簿中的每个工作表做的,关于如何实现这一点的任何想法?

tell application "Microsoft Excel"
        set rangeVoltage to value of range "A11:A110"
        set value of cell "D11:D110" to rangeVoltage        
        set value of cell "E11" to "=B11*1000"
        fill down range "E11:E110"
        set value of cell "D10" to "Voc (V)"
        set value of cell "E10" to "Isc (mA)"
end tell

1 个答案:

答案 0 :(得分:2)

尝试:

tell application "Microsoft Excel"
    set mySheets to every sheet of active workbook
    repeat with aSheet in mySheets
        tell aSheet
            set rangeVoltage to value of range "A11:A110"
            set value of cell "D11:D110" to rangeVoltage
            set value of cell "E11" to "=B11*1000"
            fill down range "E11:E110"
            set value of cell "D10" to "Voc (V)"
            set value of cell "E10" to "Isc (mA)"
        end tell
    end repeat
end tell