Sub tirage()
pasdepot = False
Dim coll As Collection
Set coll = New Collection
tablo = Range("A4:B" & Range("A65536").End(xlUp).Row)
If UBound(tablo, 1) Mod 2 <> 0 Then
MsgBox ("Il faut un nombre pair de joueurs et joueuses")
Exit Sub
End If
While coll.Count < UBound(tablo, 1) / 2
n = n + 1
If n = 1000 Then
pasdepot = True
Exit Sub
End If
Randomize
x = Int(UBound(tablo, 1) * Rnd + 1)
y = Int(UBound(tablo, 1) * Rnd + 1)
'MsgBox (x & " " & y)
If x <> y And tablo(x, 1) <> "" And tablo(y, 1) <> "" And tablo(x, 2) & tablo(y, 2) <> "FF" Then
On Error Resume Next
[COLOR="Red"]coll.Add tablo(x, 1) & " et " & tablo(y, 1), CStr(tablo(x, 1) & " et " & tablo(y, 1))[/COLOR]
If Err.Number = 0 Then
tablo(x, 1) = ""
tablo(y, 1) = ""
End If
On Error GoTo 0
End If
Wend
[COLOR="Red"]Range("Feuil2!B4:B" & Range("A65536").End(xlUp).Row).ClearContents[/COLOR]
For n = 1 To coll.Count
[COLOR="red"]Sheets("Feuil2").Cells(n + 4, 2) = coll(n)[/COLOR]
Next n
End Sub