This will give you 7 non-repeating numbers between 1 and 47.
Code:
Dim nTry As Integer
Dim nAddCount As Integer
Dim bFound As Integer
Dim nDummy As Integer
Dim MyCollection As New Collection
Randomize
Do Until nAddCount = 7
nTry = Int((47 - 1 + 1) * Rnd + 1)
On Error Resume Next
nDummy = MyCollection.Item(CStr(nTry))
bFound = (Err = 0)
If bFound Then
Err.Clear
Else
MyCollection.Add nTry, CStr(nTry)
nAddCount = nAddCount + 1
End If
Loop
You'll probably need to modify your BubbleSortNumbers to accept the collection rather than your array, or you could do this before you call the bubble sort.
Code:
For nAddCount = 0 to MyCollection.Count
ICheck7(nAddCount) = MyCollection.Item(nAddCount)
Next nAddCount
If you need more help you could EMail me if you want to.
------------------
Marty
[This message has been edited by MartinLiss (edited 12-08-1999).]