|
Option Explicit
Sub TEST1()
Dim ar, br, i&, r&
ar = Split([AY2].Value, ",")
r = Cells(Rows.Count, "AS").End(xlUp).Row
br = Range("AS1:AT" & r).Value
For i = 0 To UBound(ar)
ar(i) = br(ar(i), 2)
Next i
ar = Split(Join(ar, ","), ",")
ReDim br(UBound(ar))
For i = 0 To UBound(ar)
br(i) = Val(ar(i))
Next i
bSort1 br, 0, UBound(br)
[Ay3].Value = Join(br, ",")
Beep
End Sub
Function bSort1(ByRef ar, ByVal iFirst&, ByVal iLast&, _
Optional ByVal isOrder As Boolean = True)
Dim i&, j&, vTemp
For i = iFirst To iLast - 1
For j = iFirst To iLast + iFirst - 1 - i
If ar(j) <> ar(j + 1) Then
If ar(j) < ar(j + 1) Xor isOrder Then
vTemp = ar(j)
ar(j) = ar(j + 1)
ar(j + 1) = vTemp
End If
End If
Next j
Next i
End Function
|
|