Private Sub Form_Load()
Dim temp As New Collection
Dim a(9) As String, num As Integer
For i = 1 To 20
temp.Add i
Next
Randomize
For i = 0 To 9
num = Int(Rnd * temp.Count + 1)
a(i) = temp(num)
temp.Remove num
Next
Set temp = Nothing
MsgBox Join(a(), ","), 64, "10 random number between 1 to 20"
End Sub
dim a as new collection
dim i as integer
dim b as integer
for i = 1 to 20
a.add i
next
for i=1 to 10
randomize
b=int(rnd()*a.count)+1
debug.print a(b)
a.delete b
next