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 40 41 42 43 44 45 46 47 48 49 50 51 52
| Sub Regroupe_par_compte()
With Application
.Calculation = xlCalculationManual
.EnableEvents = False
.ScreenUpdating = False
End With
Dim T#
T = Timer
Set Base = Sheets("feuil1")
Set Resultat = Sheets("feuil2")
Dim d1 As New Dictionary
tblbd = Base.Range("A6:G11839")
For i = 1 To UBound(tblbd)
d1(tblbd(i, 5)) = d1(tblbd(i, 5)) + tblbd(i, 7)
Next i
j = 6
For Each Eleme In d1
For i = 1 To UBound(tblbd)
If tblbd(i, 5) = Eleme Then
Resultat.Range("A" & j) = tblbd(i, 1)
Resultat.Range("B" & j) = tblbd(i, 2)
Resultat.Range("C" & j) = tblbd(i, 3)
Resultat.Range("D" & j) = tblbd(i, 4)
Resultat.Range("E" & j) = tblbd(i, 5)
Resultat.Range("F" & j) = tblbd(i, 6)
Resultat.Range("G" & j) = tblbd(i, 7)
j = j + 1
End If
Next i
Resultat.Range("A" & j) = "Total Du Compte " & Eleme
Resultat.Range("G" & j) = d1.Item(Eleme)
Resultat.Range("A" & j & ":G" & j).Interior.Color = 65535
Resultat.Range("A" & j & ":G" & j).Font.Bold = True
j = j + 1
Next Eleme
Resultat.Columns("G:G").NumberFormat = "#,##0.00"
With Application
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.ScreenUpdating = True
.DisplayAlerts = True
End With
MsgBox "Durée " & Format(Timer - T, "0.00 \sec"), , "Import"
End Sub |
Partager