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
|
Sub Trier()
dl = Range("A" & Range("A:A").Rows.Count).End(xlUp).Row
pl = 1
For l = pl To dl
lon = Len(Cells(l, 1))
t1 = ""
t2 = ""
For c = 1 To lon
t = Asc(Mid(Cells(l, 1), c, 1))
If t <= 57 Then
tn = CStr(t)
t1 = t1 + tn
Else
ta = CStr(t)
t2 = t2 + ta
End If
Next c
If t1 <> "" Then
Cells(l, 2) = t1
Else
Cells(l, 2) = 0
End If
Cells(l, 3) = t2
Next l
Range(Cells(pl, 1), Cells(dl, 3)).Select
Selection.Sort Key1:=Range(Cells(pl, 2), Cells(pl, 2)), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
For l = 1 To dl
n = Cells(l, 2)
If n > 0 Then
pln = l
Exit For
End If
Next l
Range(Cells(pln, 1), Cells(dl, 3)).Select
Selection.Sort Key1:=Range(Cells(pln, 2), Cells(dl, 2)), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub |
Partager