Problème de tri

Akarodon

XLDnaute Nouveau
Bonjour à tous !

Voilà mon problème que, j'espère, vous pourrez m'aider à résoudre.

J'ai codé un tri en VBA à partir de l'enregistrement d'une macro, et voici le code :

Sub Tri_separation()

Range("A8:Y352").Select
Selection.Sort Key1:=Range("C8"), Order1:=xlAscending, Key2:=Range("B8"), _
Order2:=xlAscending, Key3:=Range("A8"), _
Order3:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase _
:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
Range("A1").Select

End Sub


Ce tri prend en compte trois niveaux, le souci est que quand je veux rajouter un niveau pour prendre un quatrième critère de tri, j'ai une erreur.

Alors ? Une idée ?

Merci d'avance
 

Akarodon

XLDnaute Nouveau
Re : Problème de tri

Re !
le rajout de code en gras souligné

Sub Tri_separation()

Range("A8:Y352").Select
Selection.Sort Key1:=Range("C8"), Order1:=xlAscending, Key2:=Range("B8"), _
Order2:=xlAscending, Key3:=Range("A8"), _
Order3:=xlAscending, Key4:=Range("D8"), Order4:=xlAscending,_
Header:=xlGuess, OrderCustom:=1, MatchCase _
:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
Range("A1").Select

End Sub


Erreur d'exécution 1004 qui me montre la ligne DataOption2:=xlSortNormal

j'ai essayé de rajouter DataOption3:=xlSortNormal, DataOption4:=xlSortNormal

mais rien n'y fait
 

Discussions similaires

Réponses
3
Affichages
577

Membres actuellement en ligne

Aucun membre en ligne actuellement.

Statistiques des forums

Discussions
312 206
Messages
2 086 219
Membres
103 158
dernier inscrit
laufin