1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Option Explicit
Dim t As Variant, t2() As String, m As Object, x As Long, i As Long, k As Long
Sub es()
On Error Resume Next 'preferer une etiquette
Application.ScreenUpdating = False
Set m = CreateObject("Scripting.Dictionary")
t = Range("a1:f" & Cells.Find("*", , , , , xlPrevious).Row)
x = 1
For i = LBound(t) To UBound(t)
t(i, 6) = t(i, 1) & t(i, 2) & t(i, 3) & t(i, 4) & t(i, 5)
If Not m.Exists(t(i, 6)) Then
m.Add t(i, 6), t(i, 6)
ReDim Preserve t2(1 To 5, 1 To x)
For k = 1 To 5: t2(k, x) = t(i, k): Next k: x = x + 1: End If: Next i
Range("a1:e" & Cells.Find("*", , , , , xlPrevious).Row).ClearContents
Range("a1").Resize(UBound(t2, 2), UBound(t2, 1)) = Application.Transpose(t2)
Erase t, t2: Set m = Nothing
End Sub |
Partager