Private Sub Worksheet_Activate()
Dim ncol%, resu(), d As Object, w As Worksheet, tablo, i&, n&, x$, j%, repere(), ub%
ncol = 13 'nombre de colonnes à copier
ReDim resu(1 To Rows.Count, 1 To ncol)
Set d = CreateObject("Scripting.Dictionary")
d.CompareMode = vbTextCompare 'la casse est ignorée
For Each w In Worksheets
If w.Name <> Me.Name Then
tablo = w.UsedRange.Resize(, ncol)
For i = 2 To UBound(tablo)
If UCase(tablo(i, 10)) = "O" Then
n = n + 1
If IsNumeric(CStr(tablo(i, 1))) Then tablo(i, 1) = CDbl(tablo(i, 1)) 'en cas de valeur texte
x = ""
For j = 1 To ncol
resu(n, j) = tablo(i, j)
If j < 10 Then x = x & Chr(1) & tablo(i, j)
Next j
d(x) = ""
End If
Next i
End If
Next w
'---repérages dans le tableau existant---
tablo = UsedRange.Resize(, 9)
ReDim repere(1 To UBound(tablo), 1 To 1)
For i = 2 To UBound(tablo)
x = ""
For j = 1 To 9
x = x & Chr(1) & tablo(i, j)
Next j
If d.exists(x) Then repere(i, 1) = 1 'repère
Next i
repere(1, 1) = 1
'---1ère restitution et suppressions---
Application.ScreenUpdating = False
If FilterMode Then ShowAllData 'si la feuille est filtrée
ub = ncol + 1
With UsedRange
.Columns(ub).EntireColumn.Insert 'insère une colonne auxiliaire
.Columns(ub) = repere
.EntireRow.Sort .Columns(ub) 'tri pour regrouper et accélérer
On Error Resume Next 'si aucune SpecialCell
.Columns(ub).SpecialCells(xlCellTypeBlanks).EntireRow.Delete 'suppressions
.Columns(ub).EntireColumn.Delete 'supprime la colonne auxiliaire
On Error GoTo 0
End With
'---2ème restitution---
If n Then Cells(Cells(Rows.Count, 10).End(xlUp).Row + 1, 1).Resize(n, ncol) = resu
UsedRange.RemoveDuplicates Array(1, 2, 3, 4, 5, 6, 7, 8, 9), Header:=xlYes 'supprime les lignes en doublon
Columns.AutoFit 'ajuste les largeurs
With UsedRange: End With 'actualise la barre de défilement verticale
End Sub