Sub Compiler()
Dim TabData() As Variant
With Sheets("Feuil1")
LastLine = .Range("A" & .Rows.Count).End(xlUp).Row
Set zone = .Range("A1:Q" & LastLine)
.Sort.SortFields.Clear
.Sort.SortFields.Add2 Key:=zone.Columns(5), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With .Sort
.SetRange zone
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'on peut mettre tout dans un tableau VBA
TabData = zone.Value
For i = LBound(TabData, 1) + 1 To UBound(TabData, 1) - 1 'pour toutes les lignes du tableau
deb = i
While TabData(i + 1, 5) = TabData(deb, 5)
For j = 8 To 17
TabData(deb, j) = TabData(deb, j) & "-" & TabData(i + 1, j)
TabData(i + 1, j) = ""
Next j
i = i + 1
Wend
Next i
End With
With Sheets("Feuil2")
.Range("A1").Resize(UBound(TabData, 1), UBound(TabData, 2)) = TabData
.Range("A1").Resize(UBound(TabData, 1), UBound(TabData, 2)).Columns(8).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub