1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Private Sub CommandButton1_Click()
Dim FVal, PVal, Apr, Payement, ParType, TotPmts, Fmt
Const EndPeriod = 0, BeginPeriod = 1
FVal = 0
PVal = InputBox("Quelle sommes voulez-vous emprunter ?")
Apr = InputBox("Quel est le taux d'intérêt de votre emprunt ?")
If Apr > 1 Then Apr = Apr / 100
Payement = InputBox("Quel montant, désirez-vous rembourser par mois ?")
ParType = MsgBox("Effectuez-vous les remboursement " & _
"en fin de mois ?", vbYesNo)
If ParType = vbNo Then
ParType = BeginPeriod
Else
ParType = EndPeriod
End If
TotPmts = NPer(Apr / 12, -Payement, PVal, FVal, ParType)
If Int(TotPmts) <> TotPmts Then
TotPmts = Int(TotPmts) + 1
MsgBox "Il vous faudra " & TotPmts & _
" mois pour rembourser votre emprunt."
End If
End Sub |
Partager