Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My code shown below only works if the list in column A is odd.
If it's even, it loops continuously. Can someone help? ======================================= Set rng = Range("mylist") Set rng1 = rng.Offset(0, 1) Set rng2 = rng1.Offset(0, 1) rng2.Formula = "=rand()" Do While Range("e19") = False rng1.Resize(, 3).Sort Key1:=rng2 Application.Wait Now + TimeValue("00:00:01") Loop rng2.Clear ======================================== This is a "hat drawing" exercise. Basically, a list of names is in column A. I have a sub to size the range 'mylist' accordingly. They get copied to column B then randomized. The do while statement is a check (by formulas on the spreadsheet) to see if someone "drew" their own name. If so, the cell value E19 is set to TRUE. It runs the randomizer again until the value in E19=False. The problem is that it seems to loop forever if there is an even number of names in the original list. I can forward the entire workbook to someone if necessary, but just wanted to find out if someone could see anything blatant. Thanks, Rob |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Schedule Randomizer | Excel Worksheet Functions | |||
I'm looking for info on the Excel Randomizer feature | Excel Discussion (Misc queries) |