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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| Sub EtablirUneSynthese()
Dim TabSynthese As ListObject
Dim LigneSynthese As ListRow
Dim AireCouples As Range, AireCategories As Range
Dim CelDate As Range, CelNom As Range, CelCouple As Range, CelCategorie As Range, CelResultat As Range
Dim IndexCouples As Integer, IndexCategories As Integer
Dim HeureDebut, HeureFin, TempsTotal
Application.ScreenUpdating = False
HeureDebut = Timer
With Sheets("decembre")
Set AireCouples = .Range("AgentsDates")
Set AireCategories = .Range("Catégories")
End With
With Sheets("Synthèse 2")
Set CelDate = .Range("CelluleDate"): Set CelNom = .Range("CelluleNomPrenom")
Set CelCouple = .Range("CelluleAgentDate"): Set CelCategorie = .Range("CelluleCategorie")
Set CelResultat = .Range("CelluleResultat")
Set TabSynthese = .ListObjects("TableSynthese")
End With
With TabSynthese
If .ListRows.Count > 1 Then
.DataBodyRange.Delete
' Debug.Print .ListRows.Count
End If
End With
For IndexCouples = 1 To AireCouples.Count
CelCouple = AireCouples(IndexCouples)
For IndexCategories = 1 To AireCategories.Count
CelCategorie = AireCategories(IndexCategories)
DoEvents
If CelResultat > 0 Then
Set LigneSynthese = TabSynthese.ListRows.Add
With LigneSynthese
.Range(1, 1) = Format(CelDate, "dd/mm/yyyy")
.Range(1, 2) = CelNom
.Range(1, 3) = CelCouple
.Range(1, 4) = CelCategorie
.Range(1, 5) = CelResultat
End With
Set LigneSynthese = Nothing
End If
Next IndexCategories
Next IndexCouples
HeureFin = Timer
TempsTotal = HeureFin - HeureDebut
MsgBox "Temps total du traitement : " & Round(TempsTotal, 1) & " seconde(s)", vbInformation
Application.ScreenUpdating = True
Set TabSynthese = Nothing
Set CelDate = Nothing: Set CelNom = Nothing: Set CelCouple = Nothing: Set CelCategorie = Nothing: Set CelResultat = Nothing
Set AireCouples = Nothing: Set AireCategories = Nothing
End Sub |
Partager