Sub Tri_CP()
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Columns(.Columns.Count + 1).Resize(, 2).Insert xlToRight '2 colonnes auxiliaires
With .Columns(.Columns.Count + 1)
.FormulaR1C1 = "=LEFT(RC[-1],FIND("" "",RC[-1])-1)"
.Offset(, 1).FormulaR1C1 = "=MID(RC[-2],FIND("" "",RC[-2])+1,999)"
.EntireRow.Sort .Cells, xlAscending, .Cells(1, 2), , xlAscending, Header:=xlYes
.Resize(, 2).Delete xlToLeft 'supprime les colonnes auxiliaires
End With
End With
End Sub
Sub Tri_Ville()
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Columns(.Columns.Count + 1).Resize(, 2).Insert xlToRight '2 colonnes auxiliaires
With .Columns(.Columns.Count + 1)
.FormulaR1C1 = "=LEFT(RC[-1],FIND("" "",RC[-1])-1)"
.Offset(, 1).FormulaR1C1 = "=MID(RC[-2],FIND("" "",RC[-2])+1,999)"
.EntireRow.Sort .Cells(1, 2), xlAscending, .Cells, , xlAscending, Header:=xlYes
.Resize(, 2).Delete xlToLeft 'supprime les colonnes auxiliaires
End With
End With
End Sub