LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default randomizer

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Schedule Randomizer LOU Excel Worksheet Functions 1 May 9th 07 09:34 PM
I'm looking for info on the Excel Randomizer feature PJR Excel Discussion (Misc queries) 1 March 30th 06 10:56 AM


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"