Option Explicit
Sub essai()
Dim Cel As Range
Dim Matricules As Object, Roles As Object
Dim Lig As Long, Nbr As Long, I As Long, DerLig As Long, J As Long, K As Long, L As Long
Dim It, Tbl1, Tbl2
Dim LeRep As String, Ligne As String
Dim T As Single
T = Timer
Set Matricules = CreateObject("Scripting.Dictionary")
Set Roles = CreateObject("Scripting.Dictionary")
DerLig = Cells(Rows.Count, 1).End(xlUp).Row
Range("A1:B" & DerLig).Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlYes
For Each Cel In Range("A2:A" & DerLig)
Matricules(Cel.Value) = Cel.Value
Next Cel
K = 1
For Each It In Matricules.Items
L = 0
Lig = Application.Match(It, Columns(1), 0)
Nbr = Application.CountIf(Columns(1), It)
For I = 1 To Nbr
For J = 1 To Nbr
If J <> I Then
Roles(It & ";" & K) = Cells(Lig, 2).Offset(L).Value & ";" & Cells(Lig, 2).Offset(J - 1).Value
K = K + 1
End If
Next J
L = L + 1
Next I
Next It
Tbl1 = Roles.Items
Tbl2 = Roles.keys
LeRep = ThisWorkbook.Path
Open LeRep & "\Concat.txt" For Output As #1
For I = 0 To Roles.Count - 1
Ligne = ""
Ligne = Ligne & Split(Tbl2(I), ";")(0) & ";" & Tbl1(I) & ";"
Print #1, Left(Ligne, Len(Ligne) - 1)
Next I
Close #1
MsgBox Timer - T
End Sub