N
neo
Guest
Bonjour,
lors du calcul de l'interet d'un emprunt, excel(97) me retourne une valeur incorrect (3ème ligne)- voir ci-dessous. Est-ce que vous pourriez m'aider ? Merci
NEO
Affichage
Montemprunté Intérêt Remboursement Rest dû
1 000,00€ 50,00 € 200,00 € 850,00
850,00 € 42,5 200,00 € 692,5
692,5 34 625,00 € 200,00 € 527 125,00
...
VBA (calcul du nombre de remboursement d'un emprunt)
Private Sub Calcul_Click()
'Déclaration de variable
Dim annee As Integer 'Année de remboursement
Dim montant As Currency 'Montant emprunté
Dim taux As Single 'Taux d'intérêt
Dim versement As Currency 'Remboursement annuel
Dim interet As Currency 'Intérêts de l'année courante
Dim reste As Currency 'reste dû
Dim i As Integer
'Initialisation des variables
montant = Cells(2, 2)
taux = Cells(2, 3)
versement = Cells(2, 4)
i = 6
annee = 1
While montant > 0
If versement > montant Then
interet = (montant * taux) / 100
versement = montant + interet
reste = montant - versement
End If
interet = (montant * taux) / 100
reste = montant - (versement - interet)
Cells(i, 1) = annee
Cells(i, 2) = montant
Cells(i, 3) = interet
Cells(i, 4) = versement
Cells(i, 5) = reste
montant = reste
annee = annee + 1
i = i + 1
Wend
End Sub
[ol][/ol][ol][li]
lors du calcul de l'interet d'un emprunt, excel(97) me retourne une valeur incorrect (3ème ligne)- voir ci-dessous. Est-ce que vous pourriez m'aider ? Merci
NEO
Affichage
Montemprunté Intérêt Remboursement Rest dû
1 000,00€ 50,00 € 200,00 € 850,00
850,00 € 42,5 200,00 € 692,5
692,5 34 625,00 € 200,00 € 527 125,00
...
VBA (calcul du nombre de remboursement d'un emprunt)
Private Sub Calcul_Click()
'Déclaration de variable
Dim annee As Integer 'Année de remboursement
Dim montant As Currency 'Montant emprunté
Dim taux As Single 'Taux d'intérêt
Dim versement As Currency 'Remboursement annuel
Dim interet As Currency 'Intérêts de l'année courante
Dim reste As Currency 'reste dû
Dim i As Integer
'Initialisation des variables
montant = Cells(2, 2)
taux = Cells(2, 3)
versement = Cells(2, 4)
i = 6
annee = 1
While montant > 0
If versement > montant Then
interet = (montant * taux) / 100
versement = montant + interet
reste = montant - versement
End If
interet = (montant * taux) / 100
reste = montant - (versement - interet)
Cells(i, 1) = annee
Cells(i, 2) = montant
Cells(i, 3) = interet
Cells(i, 4) = versement
Cells(i, 5) = reste
montant = reste
annee = annee + 1
i = i + 1
Wend
End Sub
[ol][/ol][ol][li]