【发布时间】:2026-02-07 09:55:01
【问题描述】:
我正在尝试使用 AppleScript 循环遍历 Excel 电子表格中手动自动过滤范围内的单元格。手动选择包括单列中的自动过滤单元格。我的代码正确显示了所选范围内第一个单元格的内容。但是,它显示第一个自动过滤单元格和最后一个单元格之间的每个单元格的值,过滤器应排除(即隐藏在电子表格上)的值。我想将脚本输出限制为仅显示符合过滤条件的单元格。
tell application "Microsoft Excel"
set myRange to selection --> selected cells of 1 col of autofiltered range
set rowCount to (count every row of myRange)
repeat with j from 1 to rowCount
set cellVal to value of cell j of myRange
display dialog "Current cellVal: " & cellVal
end repeat
end tell
【问题讨论】:
-
我不知道 AppleScript,但如果它是 Excel 函数,你会使用 SUBTOTAL 而不是 COUNT。
标签: excel macos applescript