View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Random Number Generator

Sub GenRandom()
With Range("A1:A500")
.Formula = "=Row()"
.Formula = .Value
.Offset(0, 1).Formula = "=rand()"
.Resize(, 2).Sort Key1:=Range("B1"), Header:=xlNo
End With
Columns(2).ClearContents
Range("A101:A500").ClearContents
End Sub



--
Regards,
Tom Ogilvy




"dok112" wrote in
message ...

Hello everyone,

I could use some help from y'all. I have a macro that is going to loop
through the range (A1:A100), and use the number in that particular cell
to fill in range(B1:B100) with the corresponding question. Now, what I
need help creating, is a random number generator to fill in the
range(A1:A100) with a random number. There are approximately 500
questions that will be available, so I don't want it to use the same
question twice. How can I create a macro to randomly generate a number
from 1 to 500 and enter them into range(A1:A100) and not using the same
number again...

Any help will be greatly appreciated.


--
dok112
------------------------------------------------------------------------
dok112's Profile:

http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=484726