Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I presume that no group should attend the same activity twice. So: Option Explicit Public Sub gen5periods() Dim i As Long Dim j As Long Dim k As Long Dim brepeat As Boolean Range("B2:B24").FormulaArray = "=uniqrandint(23,false)" For i = 3 To 6 brepeat = True Do While brepeat Range(Cells(2, i), Cells(24, i)).FormulaArray = "=uniqrandint(23,false)" brepeat = False For j = 2 To i - 1 For k = 2 To 24 If Cells(k, j).Value = Cells(k, i).Value Then brepeat = True End If Next k Next j Loop Next i End Sub My function UniqRandInt() you can find at: http://www.sulprobil.com/html/uniqrandint.html HTH, Bernd |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to keep random number from changing using RANDBETWEEN? | Excel Worksheet Functions | |||
RANDBETWEEN generating numbers outside range | Excel Worksheet Functions | |||
how can I use randbetween without repeating numbers in a set | Excel Worksheet Functions | |||
Non-random numbers generated by excel's data analysis random gener | Excel Worksheet Functions | |||
Non-random numbers generated by excel's data analysis random gener | Excel Discussion (Misc queries) |