View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Darren Darren is offline
external usenet poster
 
Posts: 137
Default Generating random numbers from a given range

Thankyou for the prompt reply. Now that I have my random list of 4, I want to
find these values from within cells D1:AA1 and copy the corresponding lines
of data contained in *7:*106 below the randomly generated sequence, which
subsequently now goes horizontally.

"Gary''s Student" wrote:

How about:

Sub pickum()
v1 = randbetween(1, 6)
v1 = v1 & Chr(10) & randbetween(7, 12)
v1 = v1 & Chr(10) & randbetween(13, 18)
v1 = v1 & Chr(10) & randbetween(19, 24)
MsgBox v1
End Sub

--
Gary''s Student - gsnu201001


"Darren" wrote:

I want to generate 4 random numbers from a range of 1 through to 24. Each
number has to be different from the other 3 though. Is there a way to do
this?