Bonsoir coco_1973, tulipe_4, jmd, le forum
tulipe_4 a dit :
ce serai faisable sans cette touchette de vba ;mais je ne te raconte pas le binz ......
Vois aussi cette macro :
Option Explicit
Sub Concatener()
Dim a, i As Long, n As Long
Application.ScreenUpdating = False
With Sheets(1)
a = .Range("A1").CurrentRegion.Columns("B:C").Value
n = 1
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 2 To UBound(a, 1)
If Not .exists(a(i, 1)) Then
n = n + 1
a(n, 1) = a(i, 1)
a(n, 2) = a(i, 2)
.Item(a(i, 1)) = n
Else
a(.Item(a(i, 1)), 2) = a(.Item(a(i, 1)), 2) & " | " & a(i, 2)
End If
Next
For i = 2 To n
.Item(a(i, 1)) = a(i, 2)
Next
With Sheets(2).Range("A1")
With .CurrentRegion
With .Columns(4)
.Offset(1).Resize(.Rows.Count - 1).ClearContents
End With
a = .Value
End With
End With
For i = 2 To UBound(a, 1)
If .exists(a(i, 3)) Then
a(i, 4) = .Item(a(i, 3))
End If
Next
End With
End With
With Sheets(2).Cells(1, 4).Resize(UBound(a, 1))
.Value = Application.Index(a, 0, 4)
.CurrentRegion.Columns(4).AutoFit
End With
Application.ScreenUpdating = True
End Sub
klin89