[英]VBA #VALUE!" error while using a Function
Still one hair remaining... not for long 还剩下一根头发...时间不长
This : 这个 :
Function Around(Compare As String)
Around = (Range(Compare).Value = Range(Compare).Offset(-1, 0).Value) Or (Range(Compare).Value = Range(Compare).Offset(1, 0).Value)
End Function
generates a #VALUE! 产生#VALUE! in the cell that calls it 在调用它的单元格中
I cannot figure out why 我不知道为什么
Any clues ? 有什么线索吗?
I think #Value error while accessing user defined function in VBA does not apply here. 我认为在VBA中访问用户定义的函数时出现#Value错误在这里不适用。
I'm guessing you're typing the formula in like =Around(E8)
, when you need to type it in as =Around("E8")
since Compare
is a String
: 我猜您在以=Around(E8)
输入公式时,由于Compare
是一个String
因此需要以=Around("E8")
输入公式:
If you want to type it without quotation marks, then you need to declare Compare
as a Range
and change some syntax: 如果要键入不带引号的字符,则需要将Compare
声明为Range
并更改一些语法:
Function Around(Compare As Range)
Around = (Compare.Value = Compare.Offset(-1, 0).Value) Or (Compare.Value = Compare.Offset(1, 0).Value)
End Function
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.