For some reason this script doesn't go to the next empty cell in column?
我做错了什么? 我希望能够将今天的日期添加到列中的下一个空单元格中 如果这些数字不会改变但保持在那个日期,那就太好了
需要一些帮助 预先感谢。
on run {input, parameters}
tell application "Numbers"
activate
tell the first table of the active sheet of document 1
tell column "F"
set r to (address of row of last cell whose value is greater than "")
set r to r + 1
set value of cell r to date string of (current date)
end tell
end tell
end tell
return input
end run
这是我用来查找列中下一个空单元格的代码:
tell application "Numbers"
tell front document
tell table 1 of sheet 1
set fullSheet to 1
repeat
set cellValue to value of cell ("A" & fullSheet) --of table 1 of sheet 1
if cellValue = missing value then exit repeat
set fullSheet to fullSheet + 1
end repeat
end tell
end tell
end tell
我知道它不是很迷人,但自 2014 年 2 月以来,它一直在所有数字升级中发挥作用。
我不确定为什么脚本中的选择器不起作用,但我需要做同样的事情并想出了这种方法;我使用错误捕获来覆盖没有行为空的情况
tell application "Numbers"
tell table 1 of active sheet of front document
tell column "A"
try
set the_cell to first cell whose value is missing value
on error -- no empty cell in this column, need to add row
add row below last row
set the_cell to cell (count of rows)
end try
set value of the_cell to current date
-- get row number in case need to set values in other columns
set the_row to address of row of the_cell
end tell
end tell
end tell