Option Explicit
Sub TEST_A4()
Dim R&, Arr, LN&, i&
R = Cells(Rows.Count, 1).End(xlUp).Row
If R < 3 Then Exit Sub
With Range("A2:A" & R)
Arr = .Value
For i = 1 To .Count
LN = 10 - Len(Arr(i, 1))
Arr(i, 1) = Application.Rept("|", LN) & Arr(i, 1)
Next i
.Value = Arr
.Sort Key1:=.Item(1), Order1:=xlAscending, Header:=xlNo
.Replace "|", "", Lookat:=xlPart
End With
End Sub
É¥Îã¤jקï¦p¤U
Sub TEST()
Dim R&, Arr, LN&
R = Cells(Rows.Count, 1).End(xlUp).Row
If R < 3 Then Exit Sub
With Range("A2:A" & R)
Arr = .Value
For i = 1 To .Count
ipos = InStr(5, Arr(i, 1), "-")
If ipos > o Then
xR = Mid(Arr(i, 1), 1, ipos - 1)
Arr(i, 1) = 100 + IIf(LN = 0, 99, ipos - 1) & "|" & Arr(i, 1)
Else
LN = Len(Arr(i, 1))
Arr(i, 1) = 100 + IIf(LN = 0, 99, LN) & "|" & Arr(i, 1)
End If
Next i
.Value = Arr
.Sort Key1:=.Item(1), Order1:=xlAscending, Header:=xlNo
.Replace "*|", "", Lookat:=xlPart
End With
End Sub