Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Fixture Lists

Hi all,

Be prepared ! This is the time of yesr when requests for code to prepare
League Fixtures start floating around. The code below does just that. To
use, copy the code to a standard module, select a blank worksheet, enter the
number of teams in "A1" and then run.
Columns show the matches for each fixture by numbers e.g. Team 1 v Team 4.
For a different number of teams enter a new value in "A1". Two teams using
the same venue can be paired using any of the Home/Away numbers shown below
the fixtures. Should anyone be interested in a full App. which uses actual
names and dates, neatly prints out the fixtures, keeps a record of the
results of matches played and maintains an up-to-dte League Table, then
please contact me direct.

Regards,
Don.

Sub Fixtures()
Dim Draw() As Integer, Vnu() As Integer
Dim T, F, C, x, y, V, DestRw, DRw2, Mtch
T = Int(Cells(1, 1))
If T Mod 2 0 Then T = T + 1
F = T - 1
ReDim Draw(T, F)
ReDim Vnu(T, F)
Cells.Clear
C = 4 ' DRAW
For x = 1 To F: For y = 1 To T - 1
If y 1 Then C = C + 1
If C F Then C = 1
Draw(x, y) = C
If C = x Then
Draw(T, y) = C: Draw(x, y) = T
End If
Next y, x
V = 1 ' VENUES
For x = 1 To T / 2: For y = 1 To F
If V = 1 Then Vnu(x, y) = V
If Draw(x, y) < T And y < F Then V = V * -1
Next y
V = V * -1
Next x
For x = 1 To T / 2: For y = 1 To F
If Vnu(x, y) = 0 Then Vnu(x + T / 2, y) = 1
Next y, x
Application.ScreenUpdating = False
DestRw = 2 ' PRINT to SCREEN
For x = 1 To F: For y = 1 To T
If Vnu(y, x) = 1 Then
Mtch = y & " v " & Draw(y, x)
Cells(DestRw, x) = Mtch
Mtch = Draw(y, x) & " v " & y
DRw2 = Int(DestRw + 2 + F / 2)
Cells(DRw2, x) = Mtch
DestRw = DestRw + 1
End If
Next
DestRw = 2
Next
Cells.Columns.AutoFit
Cells(1, 1) = T
Cells(1, 2) = "Teams - 1st Half Fixtures."
Cells(T / 2 + 2, 2) = "2nd Half -Venues reversed."
Cells(T + 4, 2) = "Home/Away Teams"
DestRw = T + 5
For x = 1 To T / 2
Mtch = x & " & " & x + T / 2
Cells(DestRw, 2) = Mtch
DestRw = DestRw + 1
Next
End Sub


Reply
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
Creating a fixture list Gilbo Excel Discussion (Misc queries) 3 January 2nd 10 02:51 PM
how to create a fixture grid for 18 teams Tom Burke Excel Discussion (Misc queries) 0 June 26th 09 12:27 PM
making a fixture list [email protected] Excel Discussion (Misc queries) 1 September 19th 06 01:58 PM
Fixture list in excel? Paul Mc Excel Discussion (Misc queries) 0 March 22nd 06 01:31 PM
Creating fixture lists Frazer Snowdon Excel Worksheet Functions 11 April 23rd 05 03:16 PM


All times are GMT +1. The time now is 05:39 PM.

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

About Us

"It's about Microsoft Excel"