surgeon84fr
XLDnaute Junior
Bonjour le forum
J'ai un fichier excel avec beaucoup de colonnes.
J'ai tenté l'enregistrement d'une macro pour m'aider à trouver le moyen d'automatiser un tri. Mais je n'y arrive pas...
Voici mon code:
En fait, je ne trouve pas le moyen de mettre en boucle le KEY:= qui va de la colonne AV à la colonne DG.
Il y en a 64...
Merci d'avance pour votre aide.
J'ai un fichier excel avec beaucoup de colonnes.
J'ai tenté l'enregistrement d'une macro pour m'aider à trouver le moyen d'automatiser un tri. Mais je n'y arrive pas...
Voici mon code:
Option Explicit
Sub TRIPROG()
Dim derlig&, dercol%, i&
With Sheets("Feuil1")
derlig = .Cells(.Rows.Count, 1).End(xlUp).Row 'dernière ligne
dercol = .Cells(1, .Columns.Count).End(xlToLeft).Column 'dernière colonne
End With
With Worksheets("Feuil1").Sort
.SortFields.Clear
.SortFields.Add Key:=[AV:AV], SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SortFields.Add Key:=[AW:AW], SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.
.
.
.SortFields.Add Key:=[DG : DG], SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange Range(Cells(1, 1), Cells(derlig, dercol))
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
En fait, je ne trouve pas le moyen de mettre en boucle le KEY:= qui va de la colonne AV à la colonne DG.
Il y en a 64...
Merci d'avance pour votre aide.