Hi everyone,
I have been trying repeatedly for days now to write a macro to generat
random numbers. I need to generate 23 unique numbers in 5 columns.
have found a macro that can do one column at a time but i cannot modif
this to work over the five columns.
Here is the code for you to look at:
Sub CreateRand()
Dim Nums(23)
Dim I As Integer
Dim X As Integer
Dim rng As Range
Dim c As Range
Dim Filled As Boolean
For I = 1 To 23
Nums(I) = I
Next I
Set rng = Range("f1:f23")
For Each c In rng
Do
X = Int((Rnd * 23) + 1)
If Nums(X) < 0 Then
c.Value = Nums(X)
Nums(X) = 0
Filled = True
End If
Loop Until Filled
Filled = False
Next c
End Sub
All help will be greatly received!!!!!!
Thanks, a slowly going bald Excel use
--
davehill197
-----------------------------------------------------------------------
davehill1974's Profile:
http://www.excelforum.com/member.php...fo&userid=2499
View this thread:
http://www.excelforum.com/showthread.php?threadid=38521