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

dim v(1 to 6) as Long
i = 0
do while i < 6
j = int(rnd()*6+1)
if v(j) = 0 then
i = i + 1
v(j) = i
end if
Next
j = 0
for i = 1 to 6
if v(i) < 0 then
j = j + 1
cells(j,1).Value = i
end if
Next


"lordofthe9" wrote in message
oups.com...

Hi.

I am using VBA within Excel and have to generate the following:

4 Integers between 1 and 6 inclusive, none of which are the same.

I can only use VBA to do this.

Thanks,

lot9