View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rocky McKinley Rocky McKinley is offline
external usenet poster
 
Posts: 102
Default Excel random sorting query

This might work for you...put your list of 12 numbers in A1:A12 in any sheet
and the list will be generated in Range(D1:I25)

Sub GenerateList()
Dim R As Byte, C As Byte
For R = 1 To 25
For C = 4 To 9
Cells(R, C) = Cells(Int((12 * Rnd) + 1), 1).Value
Next C
Next R
End Sub

--
Regards,
Rocky McKinley


"Edwin Tam (MS MVP)" wrote in message
...
In fact, you don't need programming to achieve your task. Let's try to see

how to solve it using Excel's built-in worksheet functions.

For example, you got your list of 12 numbers in column A, in the range

A1:A12.
Now, create your first list of 6 "randomly picked" numbers in column C, in

the range C1 to C6.

In cell C1, type the following formula:
=INDEX(A$1:A$12,INT(INT((12 * RAND()) + 1)))

Then use the mouse the drag the formula down, up to cell C6.
If you want 25 columns of such "randomly picked" numbers, with C1:C6

selected, use the mouse to drag the cells across to fill 25 columns to the
right.

Now, a final step, if you want to "fix" the content of the cells (the

values of the cells change every time the worksheet recalculates), with the
25 columns selected, from the "Edit" menu, choose COPY, then choose "Paste
Special", paste only the Values.

It should be quite fast to complete the above steps. But if you insist to

do it in a VBA way, let me know.


----- fingers wrote: -----

I am trying to generate 'x' discrete lists of 6 numbers. The 25 lists
must come from a selected list of 12 of numbers. ie
12 numbers = Excel takes 6 random numbers from the list to create

'x'
number of lists.
Can anyone suggest a way of doing this?
Thanks