Hi, I'm doing a work for school with vba and excel, but I have a problem. I think it's slow because one of my row need an other one to calculate. I don't know if there's a way to do that faster, because right now I have a delay of 10-15 secondes each time I change something.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
nbgele = Cells(4, 9)
n = Cells(4, 3)
interet = Cells(6, 3)
nb = Cells(5, 9) * 12
If Cells(8, 10) = "oui" Then
Range("C11:C300").Clear
Cells(8, 10) = ""
End If
For c = 12 To nb + 11
solde = Cells(11, 10)
t = Cells(11, 2)
paiement = (solde * interet) / (1 - (1 + interet) ^ (t - n))
Cells(c, 5) = paiement
Next
For i = nb + 12 To n + 11
If Cells(i, 3) = "" Then
solde = Cells(i - 1, 10)
t = Cells(i - 1, 2)
paiement = (solde * interet) / (1 - (1 + interet) ^ (t - n))
Cells(i, 5) = paiement
Else
numeroLigne = i
solde = Cells(numeroLigne - 1, 10)
t = Cells(numeroLigne - 1, 2)
paiement = (solde * interet) / (1 - (1 + interet) ^ (t - n))
For a = 0 To nbgele - 1
Cells(numeroLigne + a, 5) = paiement
If (n - i) > nbgele Then
Cells(numeroLigne + a, 3) = Cells(numeroLigne, 3)
Else
Cells(i, 3) = ""
End If
Next
i = numeroLigne + nbgele - 1
End If
Next
If Cells(3, 3) = 20 Then
For j = 1 To 60
Cells(251 + j, 5) = ""
Next
End If
Application.EnableEvents = True
End Sub
Bookmarks