Bonjour,
J'ai un tableau dynamique à 2 dimensions. J'aimerais savoir s'il est possible de trier le tableau sur plusieurs critères comme dans une feuille excel.
Par exemple, j'ai ceci en range :
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
nb_LT_viole = Range("A2").CurrentRegion.Rows.Count
 
 
    ActiveWorkbook.Worksheets("LT violé").AutoFilter.Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("LT violé").AutoFilter.Sort.SortFields.Add Key:=Range(Cells(2, 3), Cells(nb_LT_viole + 1, 3)) _
    , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("LT violé").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
 
End Sub
ou bien :

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
20
21
22
23
24
25
nb_transaction = Range("F2").CurrentRegion.Rows.Count
 
 
    ActiveWorkbook.Worksheets("Transactions").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Transactions").Sort.SortFields.Add Key:=Range(Cells(2, 6), Cells(nb_transaction + 1, 6)) _
       , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    ActiveWorkbook.Worksheets("Transactions").Sort.SortFields.Add Key:=Range(Cells(2, 9), Cells(nb_transaction + 1, 9)) _
        , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    ActiveWorkbook.Worksheets("Transactions").Sort.SortFields.Add Key:=Range(Cells(2, 10), Cells(nb_transaction + 1, 10)) _
        , SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Transactions").Sort
        .SetRange Range(Cells(2, 1), Cells(nb_transaction + 1, 22))
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
 
 
 
End Sub
Est-il possible de trier dans le tableau dynamique, car je viens de découvrir que les tableaux sont de loin, bien plus rapide que la méthode des "Range".

Merci !

Hehee