当先锋百科网

首页 1 2 3 4 5 6 7

VBA怎么样对于数组进行排序?

最简单的排序,须借助excel的函数:Sub SmallSort()Dim a(-1 To 3), i, b()For i = LBound(a) To UBound(a) a(i) = Int(Rnd * 10) '赋值给a()NextRows("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)) = bEnd Sub

java 有序数组合并,VBA怎么样对于数组进行排序