Priavate Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
It Intersect(Target, Range("a:a")) Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In Intersect(Target, Range("a:a"))
If InStr(r.Value, ",") > 0 Then
x = Split(r.Value, ",")
SortA x, 0, UBound(x)
r.Value = Join(x,",")
End If
Next
Application.EnableEvents = True
End Sub
Private Sub SortA(ary, LB, UB)
Dim i As Long, ii As Long, M As VAriant, temp As Variant
i = UB : ii = LB
M = Val(ary(Int((LB + UB)/2)))
Do While ii <= i
Do While Val(ary(ii)) < M
ii = ii + 1
Loop
Do While Val(ary(i)) > M
i = i - 1
Loop
If ii <= i Then
temp = ary(ii) : ary(ii) = ary(i) : ary(i) = temp
i = i - 1 : ii = ii + 1
End If
Loop
If LB < i Then SortA ary, LB, i
If ii < UB Then SortA ary, ii, UB
End Sub