I'm running the following code which is taken from
http://www.mrexcel.com/board2/viewtopic.php?p=1112482&highlight=rand#1112482
Dim MY_RND_NO(80) As Variant
Sub CREATE_RANDOM()
Randomize
Range("C1:C100").ClearContents
MY_COUNT = 1
Do Until MY_COUNT = 101
NEW_NUMBER = Int(Rnd() * (561 - 1) + 1)
If MY_RND_NO(NEW_NUMBER) <> "USED" Then
Range("C" & MY_COUNT).Value = NEW_NUMBER
MY_RND_NO(NEW_NUMBER) = "USED"
MY_COUNT = MY_COUNT + 1
End If
Loop
End Sub
I get a subscript out of range error because i'm trying to run this for 100 cells and over the range of random numbers from 1-561. any thoughts?
http://www.mrexcel.com/board2/viewtopic.php?p=1112482&highlight=rand#1112482
Dim MY_RND_NO(80) As Variant
Sub CREATE_RANDOM()
Randomize
Range("C1:C100").ClearContents
MY_COUNT = 1
Do Until MY_COUNT = 101
NEW_NUMBER = Int(Rnd() * (561 - 1) + 1)
If MY_RND_NO(NEW_NUMBER) <> "USED" Then
Range("C" & MY_COUNT).Value = NEW_NUMBER
MY_RND_NO(NEW_NUMBER) = "USED"
MY_COUNT = MY_COUNT + 1
End If
Loop
End Sub
I get a subscript out of range error because i'm trying to run this for 100 cells and over the range of random numbers from 1-561. any thoughts?