Tri d'un tableau de longueur variable
Bonjour,
Je cherche à trier un tableau dont la longueur peut varier via VBA.
Voici mon code sur une taille fixe:
Code:
1 2 3 4 5
| Range("A1:S1150").Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:= _
Range("C2"), Order2:=xlAscending, Key3:=Range("B2"), Order3:=xlAscending _
, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal |
J'enregistre la derniere ligne du tableau dans la variable derli. J'ai donc essayé le code suivant mais cela ne fonctionne pas:
Code:
1 2 3 4 5
| Range(cells(1,1),cells(19,derli)).Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:= _
Range("C2"), Order2:=xlAscending, Key3:=Range("B2"), Order3:=xlAscending _
, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal |
En espérant que quelqu'un sache comment faire. Merci pour votre aide. :)