'假设楼主懂VBA基础语法以及冒泡排序的原理
Public Sub Bubble(ByRef longArray() As Long)
Dim iOuter As Long
Dim iInner As Long
Dim iLBound As Long
Dim iHBound As Long
Dim iTemp As Long
iLBound = LBound(longArray)
iHBound = UBound(longArray)
For iOuter = iLBound To iHBound - 1
For iInner = iLBound To iHBound - iOuter - 1
If longArray(iInner) > longArray(iInner + 1) Then
iTemp = longArray(iInner)
longArray(iInner) = olngArray(iInner + 1)
longArray(iInner + 1) = iTemp
End If
Next iInner
Next iOuter
End Sub
‘有错误请轻喷,毕竟现学现卖>_<