Sub SmallSort()
Dim a(-1 To 3), i, b()
For i = LBound(a) To UBound(a)
a(i) = Int(Rnd * 10) '賦值給a()
Next
Rows("5:6").Delete
[a5].Resize(1, UBound(a) - LBound(a) + 1) = a
'下面是排序方法,結果放在b()內
ReDim b(1 To UBound(a) - LBound(a) + 1)
For i = 1 To UBound(b)
b(i) = Application.WorksheetFunction.Small(a, i) 'Small為從小到大,large為從大到小
Next
[a6].Resize(1, UBound(b)) = b
End Sub