Private Sub Worksheet_Activate()
Dim tablo, d As Object, i&, x$, dat, y$, n&, a, b, c()
With Sheets("Feuil1")
If .FilterMode Then .ShowAllData
tablo = .Range("H1:R" & .Range("H" & .Rows.Count).End(xlUp).Row) 'matrice, plus rapide
End With
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(tablo)
x = CStr(tablo(i, 1))
If x <> "" Then
If Not d.exists(x) Then d(x) = ""
dat = tablo(i, 11)
If IsDate(dat) Then
y = Month(dat) & Year(dat)
If InStr(d(x), Chr(1) & y) = 0 Then d(x) = d(x) & Chr(1) & y
End If
End If
Next
n = d.Count
'---transposition---
If n Then
a = d.keys
b = d.items
ReDim c(UBound(a), 1) 'base 0
For i = 0 To UBound(a)
c(i, 0) = a(i)
c(i, 1) = UBound(Split(b(i), Chr(1)))
If c(i, 1) < 1 Then c(i, 1) = ""
Next
End If
'---restitution---
If FilterMode Then ShowAllData 'si la feuille est filtrée
With [A2]
If n Then .Resize(n, 2) = c
.Offset(n).Resize(Rows.Count - n - .Row + 1, 2).ClearContents 'RAZ en dessous
End With
End Sub