VBA Trier un tableau d'une autre feuil

  • Initiateur de la discussion Initiateur de la discussion Bens7
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Bens7

XLDnaute Impliqué
Bonjour a tous !
Je recherche une ligne de code simple:
J'ai un tableau (Sheets("ANNULER")) avec un nombre de ligne qui varie tt le temp :

Je suis sur la Feuil1 avec un commandBouton :
Il doit trier la collone A de la Feuille ANNULER par ordre croisant ....
voila avec l'enregistreur de MAcro c'est un vrai bord.....:

Code:
    Range("A1").Select
    ActiveWorkbook.Worksheets("ANNULER").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("ANNULER").Sort.SortFields.Add Key:=Range("A1"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("ANNULER").Sort
        .SetRange Range("A2:T392")
        .Header = xlNo
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
 
Re : VBA Trier un tableau d'une autre feuil

Bonjour.
Essayez comme ça :
VB:
With ActiveWorkbook.Worksheets("ANNULER")
   .Sort.SortFields.Clear
   .Sort.SortFields.Add Key:=.[A1], SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
   .Sort.SetRange .[A2:T2].Resize(.[A60000].End(xlUp).Row - 1)
   With .Sort
      .Header = xlNo
      .MatchCase = False
      .Orientation = xlTopToBottom
      .SortMethod = xlPinYin
      .Apply: End With: End With
 
Re : VBA Trier un tableau d'une autre feuil

VB:
With ActiveWorkbook.Worksheets("ANNULER")
   .[A2:T2].Resize(.[A60000].End(xlUp).Row - 1).Sort Key1:=.[A1], Order1:=xlAscending, _
      Header:=xlNo, OrderCustom:=1, MatchCase:=True, Orientation:=xlTopToBottom
   End With
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
XL 2021 listbox
Réponses
18
Affichages
298
Réponses
17
Affichages
1 K
Réponses
4
Affichages
211
Réponses
6
Affichages
1 K
Réponses
11
Affichages
785
Réponses
1
Affichages
1 K
Réponses
1
Affichages
821
Retour