Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need my program to create a revolving cue from entries made by individuals.
If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it should list the entries as so: 1.)Sally 7.)Kelly 2.)George 8.)Sally 3.)Pat 9.)Kelly 4.)Kelly 10.)Kelly 5.)Sally 11.)Kelly 6.)George If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10 the script would be 10.)Don 11.)Kelly 12.)Don 13.)Kelly Any suggestions on this? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm guessing that when you type "que" and "cue" you're looking for "queue",
meaning a line of people waiting to get into a theater or a stack of items waiting to be processed. Seems to me the trick here is to store each name and entry count in a collection. Then start looping through the collection, checking the entry count and, if it's 0, listing the name and decrementing the count, until every item in empty. Like this: Do bMoreData = False For Each eo In Entries If eo.Count 0 Then MsgBox eo.Name eo.Count = eo.Count - 1 if eo.Count 0 then bMoreData = True End If Next eo Loop While bMoreData At the beginning of the loop you assume this is the last time through the loop (bMoreData = False). Then you go through each item in the Entries collection, which has a name (Kelly, Pat etc) and a count (however many entries they created). If the count is still 0, my code above just MsgBoxed the name, but you'll insert code there to create a new item in your list, consisting of the person's name, and then you decrement that person's entry count. If his entry count isn't 0 yet, you're going to do another loop, so turn on bMoreData too. As long as every person has more entries to do, their names are listed in order. As soon as one's count has been reduced to 0, that person will no longer continue being listed -- but the loop will continue, the others being listed, until each one has been "listed out". I didn't get into details you may already understand, like how to create a collection and how to create an entry in your list. But if you need help on some other aspect, don't hesitate to ask. --- "KJ MAN" wrote: I need my program to create a revolving cue from entries made by individuals. If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it should list the entries as so: 1.)Sally 7.)Kelly 2.)George 8.)Sally 3.)Pat 9.)Kelly 4.)Kelly 10.)Kelly 5.)Sally 11.)Kelly 6.)George If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10 the script would be 10.)Don 11.)Kelly 12.)Don 13.)Kelly Any suggestions on this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating VBA Functions When Creating Spreadsheet Via VBA? | Excel Programming | |||
Creating and using add-ins | Excel Programming | |||
creating PNG | Excel Programming | |||
Creating | Excel Discussion (Misc queries) | |||
Help Creating XLL | Excel Programming |