Sub grouper13()
Const fichier As String = "invadj_sap"
Dim wbkSource As Workbook
Dim wbkDestination As Workbook
Dim classeur As Workbook
Set classeur = Application.Workbooks.Open("C:\Documents and Settings\,,,,\Bureau\invadj_sap.xls", , True)
Set wbkSource = Workbooks(fichier)
Set shtSource = wbkSource.Worksheets("Feuil1")
With shtSource
Set liste = CreateObject("scripting.dictionary")
For Each c In .Range("G2:G" & .Range("G" & Rows.Count).End(xlUp).Row)
liste(c.Value & "#" & c.Offset(, 1)) = liste(c.Value & "#" & c.Offset(, 1)) + 1
Next c
Workbooks("TRI INVADJ_SAP.xls").Sheets("Resultat du TRI").Range("A3:C5000").ClearContents
x = 3
For Each elem In liste.Keys
Workbooks("TRI INVADJ_SAP.xls").Sheets("Resultat du TRI").Range("A" & x).Resize(1, 2) = Split(elem, "#")
x = x + 1
Next elem
Workbooks("TRI INVADJ_SAP.xls").Sheets("Resultat du TRI").Range("C3:C" & liste.Count + 2) = Application.Transpose(liste.Items)
End With
Workbooks("TRI INVADJ_SAP.xls").Sheets("Resultat du TRI").Select
Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("A3"), DataType:=xlFixedWidth, _
FieldInfo:=Array(0, 5), TrailingMinusNumbers:=True
Range("C3").Select
End Sub