View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bernd P Bernd P is offline
external usenet poster
 
Posts: 806
Default Making random and unique selections from a list

Hello,

You are right. The naive trial and repeat approach could cause very
long runtimes if you want to get all numbers of a long list. But there
are some solutions for this. One possibility:

An example:
Sub test()
Dim v
Dim i As Long

v = VBUniqRandInt(20, 20)

For i = 1 To 20
Debug.Print Cells(v(i), 1)
Next i

End Sub

My UDF VBUniqRandInt you can find he
http://www.sulprobil.com/html/uniqrandint.html

Regards,
Bernd