有人可以帮我删除错误吗?
错误“缺失值无法转换为类型编号。”数字-1700从缺失值到数字
tell application "Numbers"
activate
open theFile
tell the first table of the active sheet of document 1
repeat with i from 2 to the count of rows of column "D"
set val1 to value of cell i of column "D"
set the value of cell i of column "D" to val1 * -1
end repeat
end tell
end tell
谢谢!
答案 0 :(得分:1)
基本上,当单元格没有任何值时会发生这种情况,因此表格中必须有一些空行。最简单的方法是使用try块,当你不能将val1乘以-1时,它将忽略所有错误。
tell application "Numbers"
activate
open theFile
tell the first table of the active sheet of document 1
repeat with i from 2 to the count of rows of column "D"
set val1 to value of cell i of column "D"
try
set the value of cell i of column "D" to val1 * -1
end try
end repeat
end tell
end tell