'### Constante de l'ordre de tri (à adapter) ###
Const ORDER As Integer = 1 ' 1=Ascending 2=Descending
'###############################################
Sub TriAlphaVersusNumeric()
Dim S As Worksheet
Dim S1 As Worksheet
Dim R As Range
Dim R1 As Range
Dim R2 As Range
Dim var
Dim i&
On Error GoTo Erreur
Application.ScreenUpdating = False
Set S = ActiveSheet
Set R = Selection.CurrentRegion
R.Sort key1:=R.Cells(1, 1), order1:=ORDER
var = R
For i& = 1 To R.Rows.Count
If Not IsNumeric(R.Cells(i&, 1)) Then
Set R1 = Range(R.Cells(i&, 1), R.Cells(R.Rows.Count, R.Columns.Count))
Set R2 = Range(R.Cells(1, 1), R.Cells(i& - 1, R.Columns.Count))
Set S1 = Sheets.Add
R1.Copy
S1.Range(S1.Cells(1, 1), S1.Cells(1, 1)).PasteSpecial xlPasteAll
R2.Copy
S1.Range(S1.Cells(R.Rows.Count - i& + 2, 1), S1.Cells(R.Rows.Count - i& + 2, 1)).PasteSpecial xlPasteAll
S1.[a1].CurrentRegion.Copy
S.Range(R.Address).PasteSpecial xlPasteAll
Application.DisplayAlerts = False
S1.Delete
S.Activate
Exit For
End If
Next i&
Erreur:
With Application
.CutCopyMode = False
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub