Bonjour,

J'ai besoin d'effectuer un tri sur une feuille excel dans une macro.
Dans l'exemple suivant, je trie par rapport aux colonnes B et C :

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
Sub Tri_Equipe()
'
' Tri_Equipe Macro
'
 
'
    Windows("Data.xlsx").Activate
    ActiveWorkbook.Worksheets("Jour").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Jour").Sort.SortFields.Add Key:=Range("B3:B12759") _
        , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("Jour").Sort.SortFields.Add Key:=Range("C3:C12759") _
        , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Jour").Sort
        .SetRange Range("A3:AK12759")
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub
Ma problématique :
Mon fichier grandit tous les jours, j'aimerais donc remplacer les 12759 par une commande indiquant la fin des colonnes.
Quelqu'un a-t-il la solution?
Merci d'avance.