Random Macros.

K

ken ogden

Hi,

Does anybody have, or are smart enough to write, an excel macro that will
produce random numbers WITHOUT duplicates. I can't see to get my head around
this problem
 
A

Anders Silven

Also asked in .newusers. Please don't multipost.

You may provide more details on what you wish the macro to produce and where.

Regards,
Anders Silven
 
J

jee22

Here is one method. It generates 99 numbers without duplicates

Sub alpha
ReDim a(99)
ReDim b(99)
Randomize Timer
For n = 1 To 99
Do
c = Int(99 * Rnd) + 1
Loop While a(c) = 1 Or c = 0 Or c > 99
b(n) = c
a(c) = 1
Next
End Sub
 
Top