Sub tirage3()
Dim joueur, tmp(2), j As Long
Dim chgmt As Boolean, c As Range
joueur = [D2].Resize(Cells(Rows.Count, "D").End(xlUp).Row - 1, 2).Value
Randomize
' aléatoire
For poule = 1 To [B17]
For j = 1 To [B1]
joueur((poule - 1) * [B1] + j, 2) = poule + Rnd()
Next j
Next poule
' trier
Do
chgmt = False
For j = 1 To [B16] - 1
If joueur(j, 2) > joueur(j + 1, 2) Then
tmp(1) = joueur(j, 1)
tmp(2) = joueur(j, 2)
joueur(j, 1) = joueur(j + 1, 1)
joueur(j, 2) = joueur(j + 1, 2)
joueur(j + 1, 1) = tmp(1)
joueur(j + 1, 2) = tmp(2)
chgmt = True
End If
Next j
Loop Until Not chgmt
Application.ScreenUpdating = False
For poule = 1 To [B17]
Set c = Cells(2, (poule - 1) * 2 + 6)
' nettoyer
c.Resize(8).ClearContents
' coller
For j = 0 To [B1] - 1
c.Offset(j) = joueur((poule - 1) * [B1] + j + 1, 1)
Next j
Next poule
End Sub