OpenOffice Calc函数返回#VALUE

时间:2016-05-20 11:29:10

标签: openoffice-calc openoffice-basic

我想为Calc写一个返回#VALUE的Basic函数!用ISERR()测试。

Function foo()
    foo = #VALUE!
End Function

但是foo函数返回0而不是错误#VALUE!。我该怎么办?

1 个答案:

答案 0 :(得分:2)

看起来#VALUE!仅在电子表格中存在计算错误时显示。所以不可能返回这样的错误。

相反,当预期数字时返回文本会导致#VALUE!错误:

Function get_number() As Any
    'get_number = 0  'This line will not cause an error.
    get_number = ""  'This line will cause #VALUE! because it is not a number.
End Function

将公式设置为=ISERR(GET_NUMBER() + 0)

请参阅https://forum.openoffice.org/en/forum/viewtopic.php?t=44830

相关问题