excel vba 内存数组按升序排序,试了几次很困惑,哪位大侠能详解,或者字典排序,十分感谢!
1个回答
展开全部
提供一个比较普通的数组冒泡排序方法
Sub ABC()
arr = Array("d", "g", "v", "p", "a")
For i = 0 To UBound(arr) - 1
For j = i + 1 To UBound(arr)
If arr(i) > arr(j) Then
Temp = arr(j)
arr(j) = arr(i)
arr(i) = Temp
End If
Next
Next
[a1].Resize(1, UBound(arr) + 1) = arr
End Sub
Sub ABC()
arr = Array("d", "g", "v", "p", "a")
For i = 0 To UBound(arr) - 1
For j = i + 1 To UBound(arr)
If arr(i) > arr(j) Then
Temp = arr(j)
arr(j) = arr(i)
arr(i) = Temp
End If
Next
Next
[a1].Resize(1, UBound(arr) + 1) = arr
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询