Option Base 1
Sub recalc()
Dim x(), y&(), i&, j&, k&, mn&, mx&
With Application
x = .Transpose(Range("A1", Cells(Rows.Count, 1).End(xlUp)))
mn = .Min(x): mx = .Max(x)
ReDim y(mn To mx)
For i = LBound(x) To UBound(x)
y(x(i)) = y(x(i)) + 1
Next
k = LBound(x)
For i = mn To mx
For j = 1 To y(i)
x(k) = i: k = k + 1
Next
Next
Range("A1").Resize(UBound(x)).Value = .Transpose(x())
End With
End Sub
|