1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Option Explicit
Sub Test()
Dim LastLig As Long, i As Long
Dim Dico As Object
Dim S As String
Dim Tb
Application.ScreenUpdating = False
With Worksheets("Feuil1")
LastLig = .Cells(.Rows.Count, 1).End(xlUp).Row
Tb = .Range("A2:D" & LastLig)
End With
Set Dico = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(Tb, 1)
S = "B(" & Tb(i, 1) & "*" & Tb(i, 2) & "*" & Tb(i, 3) & ")"
If Not Dico.Exists(Tb(i, 4)) Then
Dico.Add Tb(i, 4), "EUI " & S
Else
Dico(Tb(i, 4)) = Dico(Tb(i, 4)) & S
End If
Next i
With Worksheets("Feuil1").Range("F2").Resize(Dico.Count, 2)
.Value = Application.Transpose(Array(Dico.Keys, Dico.Items))
.Sort Key1:=.Cells(1, 1), Order1:=xlAscending, Header:=xlNo
End With
Set Dico = Nothing
End Sub |
Partager