Et avec ce nouvel essai :
Sub CompteOccur()
with activesheet.usedrange 'zone utilisée de la feuille active
t = .value
dico = arrdictionary(t, 7, 8) '7 et 8 sont les colonnes qui permettront de former la clé de recherche
.cells(1, .columns.count + 1).resize(ubound(dico), 2).value = dico
end with
end sub
Function arrdictionary(datas As Variant, colcle&, colelem&)
Dim temp(), i&, j&, n&, doublon As Boolean
ReDim temp(1 to 3, 1 to 1)
For i = LBound(datas) To UBound(datas)
For j = LBound(temp, 2) To UBound(temp, 2)
If datas(i, colcle) = temp(1, j) then
if not temp(3, j) like "*" & datas(i, colelem) & "*" Then
doublon = True
temp(2, j) = temp(2, j) + 1
temp(3, j) = temp(3, j) & "-" & datas(i, colelem)
Exit For
end if
End If
Next j
If Not doublon Then
n = n + 1
ReDim Preserve temp(1 to 3, 1 to n)
temp(1, n) = datas(i, colcle)
temp(2, n) = 1
temp(3, n) = datas(i, colelem)
End If
doublon = False
Next i
arrdictionary = Application.Transpose(temp)
End Function
Cdlt,