Private Sub Worksheet_Activate()
Dim t, plage As Range, tablo, ub%, i&, j%, d As Object, dd As Object, v#, jj%, n&
t = Timer
Set plage = Feuil1.Range("C8:R" & Feuil1.Range("C" & Rows.Count).End(xlUp).Row)
tablo = plage.Value2
ub = UBound(tablo, 2)
'---épuration---
For i = 2 To UBound(tablo)
For j = 1 To ub Step 2
tablo(i, j) = CDbl(Left(tablo(i, j), 9)) 'on garde 7 décimales
Next j, i
plage = tablo
'---résultats---
Set d = CreateObject("Scripting.Dictionary")
Set dd = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(tablo)
For j = 1 To ub Step 2
v = tablo(i, j)
If d.exists(v) Then If d(v) Then GoTo 2 Else GoTo 1 'gagne du temps
For jj = 1 To ub Step 2
If jj <> j Then If IsError(Application.Match(v, plage.Columns(jj), 0)) Then d(v) = False: GoTo 1
Next jj
d(v) = True
2 dd(v) = dd(v) + tablo(i, j + 1) 'somme
1 Next j, i
'---restitution---
With [A2]
n = dd.Count
If n Then
.Resize(n) = Application.Transpose(dd.keys) 'Transpose est limitée à 65536 lignes
.Offset(, 1).Resize(n) = Application.Transpose(dd.items)
End If
.Offset(n).Resize(Rows.Count - n - .Row + 1, 2).ClearContents 'RAZ en dessous
.Cells(0).Resize(n + 1, 2).Sort .Cells, xlAscending, Header:=xlYes 'tri croissant
End With
With UsedRange: End With 'actualise la barre de défilement verticale
Application.ScreenUpdating = True
If n Then MsgBox n & " lignes obtenues en " & Format(Timer - t, "0.00 \sec")
End Sub