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 38 39
| Private Sub Commande_Click()
Dim année As Integer
Dim investissement As Currency
DatDeb = Me.Date_Deb
an1 = Me.annee_1
nb = Me.Nombre_annee
mt = Me.Montant
DatFin = DateAdd("yyyy", nb - 1, DatDeb) - 1
FinAn1 = CDate("31/12/" & Year(DatDeb) & "")
investAn = mt / nb
NbJAn1 = DateDiff("d", DatDeb, FinAn1, 2, vbFirstFourDays)
investAn1 = investAn / 365 * NbJAn1
nb1 = Invest.ListCount
Me.Invest.RowSource = ""
For i = 1 To nb
Select Case i
Case 1
année = an1
investissement = Round(investAn1, 2)
Me.Invest.RowSource = année & ";" & Format(investissement, "#,###.00")
Case nb
année = Year(DatFin)
investissement = Round(investAn - investAn1, 2)
Me.Invest.RowSource = Me.Invest.RowSource & ";" & année & ";" & Format(investissement, "#,###.00")
Case 2 To (nb - 1)
année = (an1 - 1) + i
investissement = Round(investAn, 2)
Me.Invest.RowSource = Me.Invest.RowSource & ";" & année & ";" & Format(investissement, "#,###.00")
End Select
Next i
End Sub |
Partager