1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub VAN()
Dim periode As Integer, i As Integer
Dim taux As Double
Dim flux As Currency
Dim investissement As Currency
periode = InputBox("Quel est le nombre de périodes?", "saisie du nombre")
Range("c2").Value = periode
taux = InputBox("Quel est le taux d'actualisation?", "saisie du taux")
If taux > 1 Then taux = taux / 100
Range("c3").Value = taux
investissement = InputBox("Quel est le montant de l'investissement?", "saisie du montant")
Range("c1").Value = investissement
For i = 1 To periode
flux = InputBox("Quel est le montant de la CAF" & i, "saisie du montant")
Cells(i + 7, 4).Value = flux
Next
Range("d7") = -Range("c1")
Range("F1") = WorksheetFunction.NPV(taux, Range("D8:D100").Value) - investissement
Range("F2") = Application.WorksheetFunction.IRR(Columns("D:D").EntireColumn)
End Sub |