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
| Private Sub Générer_Click()
Dim t_mJournal As Integer, t_mBudget As Integer, i As Integer, j As Integer
With ActiveSheet
t_mJournal = .Range("D3").CurrentRegion.Rows.Count - 1
ReDim mJournal(t_mJournal - 1)
For i = 0 To t_mJournal - 1 'Boucle pour remplir montant de ??????
mJournal(i).code = .Range("D4").Offset(i).Value
mJournal(i).montant = .Range("E4").Offset(i).Value
Next i
t_mBudget = .Range("A3").CurrentRegion.Rows.Count - 1
ReDim mBudget(t_mBudget - 1)
For i = 0 To t_mBudget - 1 'Boucle pour remplir montant de ??????
mBudget(i).code = .Range("A4").Offset(i).Value
mBudget(i).montant = 0
Next i
For i = 0 To UBound(mJournal) 'Boucle pour remplir montant de mBudget
For j = 0 To UBound(mBudget)
If mBudget(j).code = mJournal(i).code Or mBudget(j).code = Round(mJournal(i).code / 10, 0) Or mBudget(j).code = Round(mJournal(i).code / 100, 0) Then
mBudget(j).montant = mBudget(j).montant + mJournal(i).montant
End If
Next j
Next i
For i = 0 To UBound(mBudget) ' Boucle pour afficher Budget
.Range("B4").Offset(i).Value = mBudget(i).montant
Next i
End With
Debug.Print Time
End Sub |
Partager