Private Sub Worksheet_Activate()
Dim a, ub%, ncol%, base, lig&, d As Object, i&, num, nlig&
Dim j%, nlig1&, rest(), t, n&, p&, coul&
a = Array("Base", "Momo", "Lolo", "May") 'feuilles à étudier
ub = UBound(a)
ncol = 2 * ub + 3
base = Sheets(a(0)).[A1].CurrentRegion.Resize(, 3)
lig = 3 '1ère ligne à renseigner
Set d = CreateObject("Scripting.Dictionary")
Application.ScreenUpdating = False
Rows("3:" & Rows.Count).Delete 'RAZ
For i = 2 To UBound(base)
num = base(i, 1)
If Not d.exists(num) Then 'élimine les doublons
d(num) = ""
nlig = 0
For j = 1 To ub
nlig1 = Application.CountIf(Sheets(a(j)).[A:A], num)
If nlig1 > nlig Then nlig = nlig1
Next j
If nlig Then
nlig1 = Application.CountIf(Sheets(a(0)).[A:A], num)
If nlig1 > nlig Then nlig = nlig1
ReDim rest(1 To nlig, 1 To ncol)
rest(1, 1) = num
For j = 0 To ub
t = Sheets(a(j)).[A1].CurrentRegion.Resize(, 3)
n = 0
For p = 2 To UBound(t)
If t(p, 1) = num Then
n = n + 1
rest(n, 2 * j + 2) = t(p, 2)
rest(n, 2 * j + 3) = t(p, 3)
End If
Next p
Next j
coul = coul + 1
With Cells(lig, 2).Resize(nlig, ncol)
.Value = rest
If coul Mod 2 Then .Interior.ColorIndex = 24
End With
lig = lig + nlig
End If
End If
Next i
End Sub