1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Sub filtre_principal()
Dim Plagefiltre As Range, PlageBase As Range, cmptl As Long
Dim Zone As Range, Message As String
With ThisWorkbook.Worksheets("CC2012")
Set PlageBase = .Range(.Cells(1, 1), .Cells(1, 1)).End(xlDown).Resize(, 39)
End With
'------------enlève les éventuels anciens filtres
PlageBase.AutoFilter
'------------filtre la colonne St (5)
ActiveWorkbook.Worksheets("CC2012").AutoFilter.Sort.SortFields.Add Key:=Range _
("E4:E1001"), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
"2,1,0,3,A", DataOption:=xlSortNormal
'cette alternance ("2", "1", "0", "3") est une liste de tri personnalisée
' tri dans l'ordre alphabétique
With ThisWorkbook.Worksheets("CC2012").AutoFilter.Sort
.SortFields.Add Key:=Range _
("H:H"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub |