I tried this code with 4 teams in A1 and 12 games in A2:
Dim TEAM(10000) As Single
With Range("A3:B290")
.ClearContents
End With
Range("A3").Select
MY_TEAMS = Range("A1").Value
MY_GAMES = Range("A2").Value
MY_TEAM = 1
MY_TEAM_2 = 2
Do Until MY_TEAM = MY_TEAMS And MY_TEAM_2 >= MY_TEAMS
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = MY_TEAM
Range("A" & Rows.Count).End(xlUp).Offset(0, 1).Value = MY_TEAM_2
TEAM(MY_TEAM) = TEAM(MY_TEAM) + 1
TEAM(MY_TEAM_2) = TEAM(MY_TEAM_2) + 1
If MY_TEAM_2 = MY_TEAMS Then
MY_TEAM_2 = MY_TEAM + 1
Else
MY_TEAM_2 = MY_TEAM_2 + 1
End If
If TEAM(MY_TEAM_2) = MY_TEAMS Then
MY_TEAM_2 = MY_TEAM + 1
End If
If TEAM(MY_TEAM) = MY_GAMES Then
MY_TEAM = MY_TEAM + 1
MY_TEAM_2 = MY_TEAM + 1
End If
If MY_TEAM_2 = MY_TEAM Then MY_TEAM_2 = MY_TEAM + 1
Loop
But it does not even the teams games between Column A and Column B, also it doesn't stop it goes on forever.??
Ideas?
Michael