Option Base 1
Private Sub EssaiSelection)
Dim T As Variant
Dim Tsel() As String
Dim NbSel As Long
Dim Cpt1 As Long
Dim Cpt2 As Long
Dim PosAleat As Long
NbSel = Range("B1").Value
T = Range("A1:A500").Value
ReDim Preserve Tsel(1)
For Cpt1 = 1 To NbSel
Randomize
PosAleat = Int(UBound(T) * Rnd + 1)
For Cpt2 = 1 To UBound(Tsel)
If T(PosAleat, 1) = Tsel(Cpt2) Then
Exit For
End If
Next Cpt2
If Cpt1 < NbSel + 1 Then
ReDim Preserve Tsel(UBound(Tsel) + 1)
Tsel(Cpt1) = T(PosAleat, 1)
End If
Next Cpt1
ReDim Preserve Tsel(UBound(Tsel) - 1)
Range("C1").Resize(NbSel).Value = WorksheetFunction.Transpose(Tsel)
End Sub