Sub RandomPlage(Plage As Range, Optional Max As Long = 0)
Dim Arr(), ArrTmp, temp, idx As Long, i As Long, j&
Randomize
ArrTmp = Plage.Value
'Tri aléatoire du tableau
For i = Plage.Rows.Count To 1 Step -1
idx = Int(Rnd() * i) + 1
temp = ArrTmp(i, 1)
ArrTmp(i, 1) = ArrTmp(idx, 1)
ArrTmp(idx, 1) = temp
j = Plage.Rows.Count - i
If Max > 0 And j = Max Then Exit For
ReDim Preserve Arr(j)
Arr(j) = ArrTmp(i, 1)
Next i
Plage.Range("B1:B" & UBound(Arr) + 1).Value = _
Application.Transpose(Arr)
End Sub 'fs
'exemple
'pour renvoyer en B1:B7 les 7 premières valeurs, après tri, de la
'plage A1:A49 :
Sub test()
Dim DerL As Long
Application.ScreenUpdating = False
DerL = Range("A65536").End(xlUp).Row
RandomPlage Range("A1:A" & DerL) ', 7
Application.ScreenUpdating = True
End Sub