我很担心如何创建利率输入作为参数 当我尝试将Dim Rate列为单个时,错误框表示重复参数 此功能的目的是计算一组现金流的净现值(myarray)
Public Function myNPV(rate As Single, r As Range) As Single
Dim myArray(64) As Double
Dim i As Integer
Dim sum As Double
For i = 0 To n
Next i
For Each elem In r
myArray(i) = elem.Value
myArray(i) = myArray(i) / ((1 + rate / 100) ^ i)
i = i + 1
Next elem
End Function
答案 0 :(得分:2)
n 为零。 For 循环不执行任何操作。
myNPV 永远不会在UDF中分配值