macro tri automatique

  • Initiateur de la discussion Initiateur de la discussion Jec
  • 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 !

Jec

XLDnaute Nouveau
Bonjour,

Je voudrais savoir comment modifier un peu ce code. Car quand je lance on voit les actions car c est une macro que jai record. Comment rendre les actions plus discrete par exemple ne pas voir la selection du tableau etc.
Et comment supprimer l effet de bouche?

Sub macro_tri()

ActiveWorkbook.Worksheets("prod").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("prod").Sort.SortFields.Add Key:=Range("H6:H1000") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("prod").Sort.SortFields.Add Key:=Range("M6:M1000") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("prod").Sort
.SetRange Range("A5:V1000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("K6:K1000").Select
Selection.ClearContents
End Sub
 
Bonjour à tous
essayes ceci
Code:
Sub macro_tri()
    Application.ScreenUpdating = False
    With Worksheets("prod").Sort
        .SortFields.Clear
        .SortFields.Add Worksheets("prod").Range("H6:H1000"), xlSortOnValues, xlAscending, xlSortNormal
        .SortFields.Add Worksheets("prod").Range("M6:M1000"), xlSortOnValues, xlAscending, xlSortNormal
        .SetRange Worksheets("prod").Range("A5:V1000")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Range("K6:K1000").ClearContents
    Application.ScreenUpdating = True
End Sub
si Range("K6:K1000").ClearContents concerne Worksheets("prod") alors tu mets Worksheets("prod").Range("K6:K1000").ClearContents si cela concerne la feuille active tu laisse comme cela
 
- 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
505
Réponses
17
Affichages
1 K
Réponses
4
Affichages
581
Réponses
6
Affichages
1 K
Réponses
11
Affichages
841
Réponses
1
Affichages
2 K
Retour