Hi David
(this might be overkill ....) however, this code doesn't specifically check
for duplicates (it was written for a situation where duplicates were
allowed), but in my tests of generating 52 random numbers between 1 and
10000 it didn't come up with any duplicates.
---------
Sub genrand()
Dim numvals As Long
Dim destcell As String
Dim nummin As Long
Dim nummax As Long
Dim mynums() As Long
nummin = InputBox("What is the minimum number you want to allow?", "min
number", 1)
nummax = InputBox("What is the maximum number you want to allow?", "max
number", 10000)
numvals = InputBox("How many numbers do you want to generate?", "numbers
to generate", 52) - 1
destcell = InputBox("What is the cell reference of where you want the
numbers to go?", "destination cell", "A1")
ReDim mynums(numvals)
j = 0
For i = 0 To numvals
Randomize
mynums(i) = Int((nummax - nummin + 1) * Rnd + nummin)
j = j + mynums(i)
Next
Range("" & destcell & "").Select
For i = 0 To numvals
ActiveCell.Value = mynums(i)
ActiveCell.Offset(1, 0).Select
Next i
End Sub
----------
If you need help implementing it please post back
Cheers
JulieD
"David Stoddard" <David
wrote in message
...
I need to generate a random list of the whole numbers 1-52 with no
duplicates
and no decimal places.