1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Function Period_since_valo()
'Déterminer le nombre de collonne du tableau dynamique
Dim x As Integer
x = Cells(4, 2) * Cells(5, 2)
Dim i As Integer
Dim Tab_period() As Single
ReDim Tab_period(0, x)
For i = 0 To x
Tab_period(0, i) = 1 / (Cells(4, 2)) * (i + 1) - ((Cells(3, 2) - Cells(2, 2)) / 360)
Next i
End Function
Function Pricing_flow_bondB()
Dim x As Integer
x = Cells(4, 2) * Cells(5, 2)
Dim i As Integer
Dim Flow_bondB() As Single
ReDim Flow_bondB(0, x)
For i = 0 To x
Flow_bondB(0, i) = Cells(7, 2) * Cells(6, 2) * Exp(-Cells(8, 2) * Period_since_valo(0,i))
'ici j'aurai besoin de la fonction period_since_valo avec i qui va de 0 à i.
Next i
Range(Cells(13, 1), Cells(13, x)).Value = Flow_bondB()
Range(Cells(13, 1), Cells(13, x)).Borders.Value = 1
Range(Cells(13, 1), Cells(13, x)).NumberFormat = "0.00"
Dim Valeur_termB As Single
Valeur_termB = Cells(6, 2) * Exp(-Cells(8, 2) * Period_since_valo)
'Ici j'aurai besoin de la valeur de Period_since_valo avec i = x
P = Application.Sum(Flow_bondB()) + Valeur_termB |
Partager