Bonjour et merci d'avance tu temps que vous m'accordez.
Je souhaiterais faire ordre de tri de mon tableau Excel depuis VB.net 2008

J'ai réussi à adpater le code pour VB, mais quelque zone d'ombre persiste.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Dim xlApp As Excel.Application

        With xlApp
            .ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear()
            .ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add(Key:=Range(.Cells(1, 6), .Cells(Grid_customers.DataRows.Count - 1, 6)), SortOn:=Excel.XlSortOn.xlSortOnValues, Order:=Excel.XlSortOrder.xlAscending, DataOption:=Excel.XlSortDataOption.xlSortNormal)
            .ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add(Key:=Range(.Cells(1, 3), .Cells(Grid_customers.DataRows.Count - 1, 3)), SortOn:=Excel.XlSortOn.xlSortOnValues, Order:=Excel.XlSortOrder.xlAscending, DataOption:=Excel.XlSortDataOption.xlSortNormal)
            .ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add(Key:=Range(.Cells(1, 4), .Cells(Grid_customers.DataRows.Count - 1, 4)), SortOn:=Excel.XlSortOn.xlSortOnValues, Order:=Excel.XlSortOrder.xlAscending, DataOption:=Excel.XlSortDataOption.xlSortNormal)
        End With

        With xlApp.ActiveWorkbook.Worksheets("Feuil1").Sort
            .SetRange(Range("B1:F464"))
            .Header = Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes
            .MatchCase = False
            .Orientation = Excel.Constants.xlTopToBottom
            .SortMethod = Excel.XlSortMethod.xlPinYin
            .Apply()
        End With
J'ai beau rechercher sur l'Explorateur d'objet, mais les 4 "Range" que j'ai mis en subrillance me pose probléme dans le code.

Merci à vous