Hi,

I have a label1 and a command1 on my form. When the user clicks command1, a random amount of numbers, from 1 to 7 numbers, in the range of 1 to 15, appear in my label1.

I use this code, and it works well, to an extent:

Private Sub Command1_Click()
choose 1 to 7 numbers
Dim sarray(1 To 7)
'range of numbers is 1 to 15
Dim iCheck7(1 To 15)
Dim a As Integer
Dim i As Integer
Dim iTemp As Integer

For a = 1 To 15
iCheck7(a) = a
Next
Randomize
For a = 1 To 1 + Int(Rnd * 7)
i = Int(Rnd * (16 - a)) + a
iTemp = iCheck7(a)
iCheck7(a) = iCheck7(i)
iCheck7(i) = iTemp
'include a "," at the end of eacher number
sarray(a) = iCheck7(a) & ", "
Next

'print the results to label1
Label1.Caption = sarray(1) & sarray(2) & sarray(3) & sarray(4) & _
sarray(5) & sarray(6) & sarray(7)
End Sub


The problem is I need to have the numbers printed in order of size.

For example, instead of 8,3,10,1, I want to get 1, 3, 8, 10,

Could anybody tell me how to do this?

And finally, how do I get rid of that last "," character?

So instead of 1, 3, 8, 10, I would get 1, 3, 8, 10

Thanks for any help!