Bjr
Dans 1 feuille excel j'ai 3 tableaux ce synthèse de 3 colonnes et 20 lignes chacun que je souhaite voir se trier automatiquement, sur colonne 1 puis en cas d'égalité sur colonne 2, avec mise à jour automatique lors de l'ajout de données dans un autre tableau de la même feuille.
je pense qu'il me manque une "liaison" entre les pavés pour éviter le mélange....
Si qqu'un a une solution d'avance merci.
j'ai commencé à créer ce code mais si le 1er pavé fonctionne bien tout seul, l'ajout des 2 autres fait que plus rien ne fonctionne :
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Union([E2], [P29], Range("E2😛29"))) Is Nothing Then Exit Sub
Range("R2:S22").Select
Selection.Sort Key1:=Range("R2"), Order1:=xlAscending, Header:=xlGuess, _
Key2:=Range("S2"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
If Intersect(Target, Union([E33], [P60], Range("E33😛60"))) Is Nothing Then Exit Sub
Range("V2:X22").Select
Selection.Sort Key1:=Range("V2"), Order1:=xlAscending, Header:=xlGuess, _
Key2:=Range("W2"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
If Intersect(Target, Union([A62], [B80], Range("A62:B80"))) Is Nothing Then Exit Sub
Range("Z2:AB22").Select
Selection.Sort Key1:=Range("Z2"), Order1:=xlAscending, Header:=xlGuess, _
Key2:=Range("AA2"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Dans 1 feuille excel j'ai 3 tableaux ce synthèse de 3 colonnes et 20 lignes chacun que je souhaite voir se trier automatiquement, sur colonne 1 puis en cas d'égalité sur colonne 2, avec mise à jour automatique lors de l'ajout de données dans un autre tableau de la même feuille.
je pense qu'il me manque une "liaison" entre les pavés pour éviter le mélange....
Si qqu'un a une solution d'avance merci.
j'ai commencé à créer ce code mais si le 1er pavé fonctionne bien tout seul, l'ajout des 2 autres fait que plus rien ne fonctionne :
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Union([E2], [P29], Range("E2😛29"))) Is Nothing Then Exit Sub
Range("R2:S22").Select
Selection.Sort Key1:=Range("R2"), Order1:=xlAscending, Header:=xlGuess, _
Key2:=Range("S2"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
If Intersect(Target, Union([E33], [P60], Range("E33😛60"))) Is Nothing Then Exit Sub
Range("V2:X22").Select
Selection.Sort Key1:=Range("V2"), Order1:=xlAscending, Header:=xlGuess, _
Key2:=Range("W2"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
If Intersect(Target, Union([A62], [B80], Range("A62:B80"))) Is Nothing Then Exit Sub
Range("Z2:AB22").Select
Selection.Sort Key1:=Range("Z2"), Order1:=xlAscending, Header:=xlGuess, _
Key2:=Range("AA2"), Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Pièces jointes
Dernière édition: