funktion yearfrac unter vba
Pollmann
kann die Funktion yearfrac unter VBA leider nicht nutzen, es erscheint die Meldung
Sub oder Funktion nicht definiert. Ich habe bereits den VBA Analyse Toolpak installiert und _
auch in VBA eine Referenz auf atpvbaen.xls eingefügt. Was könnte noch das Problem sein?
Hier der Code:
Function Loss(settlement As Date, maturity As Date, rate, spots, _
notional, freq As Integer, compound As Integer, _
fromdate As Date, R As Double, Optional basis As Integer)
Dim price, A, y
If fromdate YearFrac(settlement, fromdate, basis)
price = MyPrice(settlement, maturity, rate, spots, notional, _
freq, compound, fromdate, basis)
A = ACI(fromdate, maturity, rate, freq, basis)
Loss = price - R * (100 + A) / _
(1 - INTSPOT(spots, y) / compound) ^ (compound * y)
Else
Loss = 0
End If
End Function
Anzeige