Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Randomize a game schedule
Hi
I have a list in column A with 14 team names How can i create a game schedule so that each team will meet each other twice (Home and away) in column C and D? Thanks for any help Kent |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Randomize a game schedule
This should do it:
Sub RoundRobin14() Dim varr As Variant Dim varr1(1 To 7, 1 To 2) Range("C:D").ClearContents varr = Worksheets("sheet1").Range("A1:A14") For i = 1 To 13 * 8 Step 8 rotate varr Split1 varr, varr1 Cells(i, 3).Resize(7, 2).Value = varr1 Next Set rng = Cells(Rows.Count, 3).End(xlUp)(2) Range(Range("C1"), rng).Copy rng.Offset(1, 1) Range(Range("D1"), rng.Offset(0, 1)).Copy rng.Offset(1, 0) End Sub Sub Split1(arr1, arr2) l = -1 For i = 1 To 14 If i <= 7 Then j = i ii = i k = 1 Else l = l + 1 ii = 14 - l j = i - 7 k = 2 End If arr2(j, k) = arr1(ii, 1) Next End Sub Sub rotate(arr) arr1 = arr For i = 2 To 13 arr(i, 1) = arr1(i + 1, 1) Next arr(14, 1) = arr1(2, 1) End Sub -- Regards, Tom Ogilvy Kent wrote in message ... Hi I have a list in column A with 14 team names How can i create a game schedule so that each team will meet each other twice (Home and away) in column C and D? Thanks for any help Kent |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Tennis Schedule - Schedule players randomly | Excel Discussion (Misc queries) | |||
how can I randomize a set of 496 numbers? | Excel Discussion (Misc queries) | |||
randomize data | Excel Discussion (Misc queries) | |||
Create patient schedule based on master therapist schedule | Excel Discussion (Misc queries) | |||
Game score without game being played | Excel Worksheet Functions |