Sub Tirage()
Dim ntirage, deb As Range, t, nlig&, d As Object, i&, x, a, h&, rest(), j&, b, n&
ntirage = 4 'paramétrable
Set deb = [F4]
t = Range("C4:D" & Range("C" & Rows.Count).End(xlUp)(2).Row) 'matrice
nlig = UBound(t)
Set d = CreateObject("Scripting.Dictionary")
'---noms sans doublons---
For i = 1 To nlig
x = t(i, 1)
If x <> "" Then d(x) = ""
Next i
If d.Count = 0 Then GoTo 1
'---tirage des ID---
a = d.keys: h = ntirage * d.Count
ReDim rest(1 To h, 1 To 2)
Randomize
For i = 0 To UBound(a)
x = a(i)
rest(ntirage * i + 1, 1) = x
d.RemoveAll
For j = 1 To nlig
If t(j, 1) = x Then d(t(j, 2)) = ""
Next j
b = d.keys: n = d.Count: d.RemoveAll
For j = 1 To IIf(n < ntirage, n, ntirage)
Do
x = b(Int(n * Rnd))
Loop While d.exists(x)
d(x) = ""
rest(ntirage * i + j, 2) = x
Next j
Next i
'---restitution---
deb.Resize(h, 2) = rest
1 deb.Offset(h).Resize(Rows.Count - deb.Row - h + 1, 2).ClearContents
End Sub