For i = 1 To 10 For j = 1 To 10 - i If a(j) > a(j + 1) Then temp = a(j + 1) a(j + 1) = a(j) a(j) = temp End If Next j Next i