Sub Worksheet_Activate()
Dim T, Tableau, DL%, Taille%, Indice%, i%
[A2:D65000].ClearContents
Application.ScreenUpdating = False
With Sheets("Sélection et Rapport")
DL = .Range("A65500").End(xlUp).Row
T = .Range("A1:J" & DL)
End With
Taille = UBound(T)
Indice = 0
ReDim Tableau(Taille, 3)
For i = 2 To Taille
If Left(T(i, 1), 5) <> "Total" Then
If T(i, 1) <> T(i - 1, 1) Then
Tableau(Indice, 0) = T(i, 1)
Tableau(Indice, 1) = T(i, 9)
Tableau(Indice, 2) = T(i, 10)
Indice = Indice + 1
End If
End If
Next i
[A2].Resize(UBound(Tableau, 1), UBound(Tableau, 2)) = Tableau
DL = Range("A65500").End(xlUp).Row
Range("D2:D" & DL).FormulaLocal = "=SOMME.SI.ENS('Sélection et Rapport'!H:H;'Sélection et Rapport'!A:A;A2)"
Range("D2:D" & DL) = Range("D2:D" & DL).Value
End Sub