VB Code:
  1. Dim nTry As Integer
  2.     Dim nAddCount As Integer
  3.     Dim bFound As Integer
  4.     Dim nDummy As Integer
  5.  
  6.     Dim MyCollection As New Collection
  7.    
  8.     Randomize
  9.    
  10.     Do Until nAddCount = 52
  11.         nTry = Int((52) * Rnd + 1)
  12.         On Error Resume Next
  13.         nDummy = MyCollection.Item(CStr(nTry))
  14.         bFound = (Err = 0)
  15.         If bFound Then
  16.             Err.Clear
  17.         Else
  18.             MyCollection.Add nTry, CStr(nTry)
  19.             nAddCount = nAddCount + 1
  20.         End If
  21.     Loop
When you want to use the values remember that collections start at 1 and not 0.