如何使用AppleScript在Excel中将单元格值增加1



这应该很简单,但我可能没有以正确的方式接近它。我只想将单元格"C7"的值从 4 增加到 5。这就是我想象它的工作方式。任何建议都非常感谢。

tell application "Microsoft Excel"
    get value of cell "C7"
    set value of cell "C7" to current value +1
end tell

在VBA和Applescript中,Excel需要知道要处理的工作簿和工作表。假设您要更改单元格的工作簿和工作表是激活的工作簿和工作表,那么:

tell application "Microsoft Excel"
tell active workbook to tell active sheet to set value of cell "C7" to (value of cell "C7") + 1
end tell

最新更新