Bonsoir, Salut Jean-Eric !
Solution macro :
Sub TirageEquipe()
Dim lst(1 To 5, 0) As String, lst0, tx$, k$, n%, i%, x%
With ActiveSheet
n = .Cells(.Rows.Count, 1).End(xlUp).Row
For i = 4 To n
If .Cells(i, 2) = "x" Then
tx = tx & ChrW(i + 32)
lst0 = lst0 & .Cells(i, 1) & ";"
End If
Next i
Randomize
For i = 1 To 5
x = Int(Len(tx) * Rnd + 1)
k = Mid(tx, x, 1): x = AscW(k) - 32
lst(i, 0) = .Cells(x, 1)
tx = Replace(tx, k, "")
Next i
lst0 = Split(lst0, ";")
Application.ScreenUpdating = False
.Range("C4:C" & n).ClearContents
.Range("C4").Resize(UBound(lst0)).Value = WorksheetFunction.Transpose(lst0)
End With
Worksheets("Joueurs").Range("B6:B10").Value = lst
End Sub
Cliquer sur la cible !
NB- Solution formules magnifique de Jean-Eric ! Difficile d'améliorer l'idée...