Private SubCommand1_Click()
Me.Font.Size = 10
Dim a(1000) As Integer
Dim i As Integer
For i = 1 To 1000
a(i) = 1000 + Int(Rnd() * 10000)
Print a(i);
Next i
Dim j As Integer
For j = 1 To 999
For i = j + 1 To 1000
If a(j) < a(i) Then
swap a(j), a(i)
End If
Next i
'next j
For i = 1 To 1000
Print a(i);
Next i
Next j
End Sub
Private Sub swap(aAs Integer, b As Integer)
Dim t As Integer
t = a
a = b
b = t
End Sub