P
Paul Black
Hi Everyone,
Tom Ogilvy Posted the Following Code in 2001 for Generating Random
Numbers :-
Sub Sets()
Application.ScreenUpdating = False
Dim my(1 To 49)
For j = 1 To 10
' Reinitialize Array Before Selecting.
For I = 1 To 49
my(I) = I
Next I
For k = 1 To 6
Randomize
NewNumber:
Number = Int(49 * Rnd) + 1
If my(Number) = "" Then
GoTo NewNumber
Else
Cells(j, k) = my(Number)
my(Number) = ""
End If
Next k
Next j
Application.ScreenUpdating = True
End Sub
This Works Excellent and Does NOT give a Repeated Number ( 1 to 49 )
in Any Set of Six Numbers.
I would like to be able to Produce a Random Number List of 200,000
Sets of Six Numbers.
How can the Above Code be Modified so that when it Reaches 65,000 Sets
of Six Numbers it Moves Nine Columns to the Right and goes Back to Row
One. I know it needs something like :-
ActiveCell.Offset(-65000, 9).Select
I do NOT know where this should be Entered into the Above Code OR the
Extra Coding that is Needed in Order for this to Work.
Any Help will be Appreciated.
All the Best
Paul
Tom Ogilvy Posted the Following Code in 2001 for Generating Random
Numbers :-
Sub Sets()
Application.ScreenUpdating = False
Dim my(1 To 49)
For j = 1 To 10
' Reinitialize Array Before Selecting.
For I = 1 To 49
my(I) = I
Next I
For k = 1 To 6
Randomize
NewNumber:
Number = Int(49 * Rnd) + 1
If my(Number) = "" Then
GoTo NewNumber
Else
Cells(j, k) = my(Number)
my(Number) = ""
End If
Next k
Next j
Application.ScreenUpdating = True
End Sub
This Works Excellent and Does NOT give a Repeated Number ( 1 to 49 )
in Any Set of Six Numbers.
I would like to be able to Produce a Random Number List of 200,000
Sets of Six Numbers.
How can the Above Code be Modified so that when it Reaches 65,000 Sets
of Six Numbers it Moves Nine Columns to the Right and goes Back to Row
One. I know it needs something like :-
ActiveCell.Offset(-65000, 9).Select
I do NOT know where this should be Entered into the Above Code OR the
Extra Coding that is Needed in Order for this to Work.
Any Help will be Appreciated.
All the Best
Paul