新手求助。编写可对一组数据进行排序的自定义函数或过程。
Private Sub Command2_Click()Dim b(1 To 20) As Integer, i%
For i = 1 To 20
b(i) = Int(Rnd * 101)
Next i
Call PX(b())
End Sub
Sub PX(ByRef a())
Dim a, iMax%, n%, i%, j%, t%
n = UBound(a)
For i = 0 To n - 1
iMax = i
For j = i + 1 To n
If a(j) > a(iMax) Then iMax = j
Next j
t = a(i)
a(i) = a(iMax)
a(iMax) = t
Next i
For i = LBound(a) To UBound(a)
Print a(i);
Next
End Sub
错误在哪里???