Option Explicit
Sub Bouton1_QuandClic()
'necessite l'activation de la reference : microsoft scripting runtime
Dim data As New Dictionary
Dim tablo, valeur, element
Dim i As Integer, ligne As Integer
Dim j As Byte
tablo = Range('a1').CurrentRegion
For i = 2 To UBound(tablo)
For j = 2 To UBound(tablo, 2)
If Not tablo(i, j) = '' Then
With data
If .Exists(CStr(tablo(i, j))) = True Then
valeur = .Item(tablo(i, j))
.Remove (tablo(i, j))
.Add Item:=valeur & ',' & tablo(i, 1), Key:=CStr(tablo(i, j))
Else
.Add Item:=tablo(i, 1), Key:=CStr(tablo(i, j))
End If
End With
End If
Next j
Next i
With Sheets('feuil2')
.Range(.Cells(1, 1), .Cells(data.Count, 1)) = Application.Transpose(data.Keys)
For Each element In data.Items
ligne = ligne + 1
tablo = Split(element, ',')
.Cells(ligne, 2).Resize(1, UBound(tablo) + 1) = tablo
Next element
End With
End Sub