我正在创建一个函数,该函数需要一个单元格和一系列单元格来创建数组。此数组的前四个数字用于执行一些计算。最后,我想将这些总和返回给单元格。在调试时,我向总和A + B + C + D添加了一个监视,结果完美地显示出来。但是,当我在工作表中调用函数时,它不会将值返回到单元格。为什么会这样?
Public Function getFone(temp As Long, coeffs As Range) As Double
Dim coeffArray As Variant
Dim A As Double
Dim B As Double
Dim C As Double
Dim D As Double
coeffArray = coeffs.Value
A = ((coeffArray(1, 1)) * (temp))
B = ((coeffArray(1, 2) / 2) * (temp * temp))
C = ((coeffArray(1, 3) / 3) * (temp * temp * temp))
D = ((coeffArray(1, 4) / 4) * (temp * temp * temp * temp))
getFone = (A + B + C + D)
End Function