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?