Private Sub CEssaie_Click()
Dim i As Long, j As Long
Dim vehicule As String
Dim no() As valeurs 'déclaration d'un vecteur de type défini dans MODULE1
Dim v, texte As Range, car As Characters
'Efface les données de la feuille 2
With Sheets("Feuil2"): .Range(.Range("A2"), .Range("A2").End(xlDown)).Resize(, 10).ClearContents: End With
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row 'Pour chaque valeur de la feuille en cour.
...
...
...
Next i
Call TriColonnes
End Sub
Sub TriColonnes()
Dim z As Range, Cel As Range, nCol As Byte
With Feuil2
nCol = .Rows(2).End(xlToRight).Column
For Each Cel In .Range("A2:A" & Rows.Count).SpecialCells(xlCellTypeConstants)
Set z = .Range("B" & Cel.Row & ":D" & Cel.Row)
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=z, _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With .Sort
.SetRange z
.Header = xlGuess
.MatchCase = False
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
Next
End With
End Sub