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 32 33 34 35 36 37 38 39 40 41 42 43 44
| 'macro sous excel 2007 (mon environement de travail)
Sub Macro1()
Dim order As String
Application.AddCustomList ListArray:=Array("c1", "c2", "c3")
order = "c1,c2,c3"
Range("A1:C1").Select
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Feuil1").Sort.SortFields.Add Key:=Range("A1:C1"), _
SortOn:=xlSortOnValues, order:=xlAscending, CustomOrder:="c1,c2,c3", _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Feuil1").Sort
.SetRange Range("A1:C1")
.Header = xlGuess
.MatchCase = True
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
End Sub
'macro sous excel 2003
Sub Macro1()
Application.AddCustomList ListArray:=Array("c1", "c2", "c3")
Range("A1:C1").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=6, MatchCase:=True, Orientation:=xlLeftToRight, DataOption1 _
:=xlSortNormal
Range("A1").Select
End Sub |
Partager