错误#Value!在Excel VBA代码中

时间:2015-10-14 09:11:10

标签: excel-vba vba excel

Function Heston(Actualvol As Double, m As Double, theta As Double, col As Double, nSim As Long, nStep As Long) As Double
    Dim FinalVol As Double, VT As Double, i As Integer, j As Integer, dt As Double, sum As Double

    dt = 1 / 252

    For i = 1 To nSim
        For j = 0 To nStep
            Actualvol = Actualvol + m * (theta - Actualvol) * dt + col * Sqr(Actualvol) * Application.NormInv(Rnd(), 0, 1) * Sqr(dt)
        Next

        sum = sum + Actualvol
    Next

    FinalVol = Sqr(sum)
    Heston = FinalVol / Sqr(nSim)
End Function

请检查一下为什么显示#Value!在ExcelSheet?

0 个答案:

没有答案