ник: Силblч
Public Function shuffle()
Dim teamArray()
teamArray = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
arr = ShuffleArrayInPlace(teamArray)
For i = LBound(arr) To UBound(arr)
Debug.Print arr(i)
Next i
End Function
Function ShuffleArrayInPlace(InArray() As Variant)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ShuffleArrayInPlace
' This shuffles InArray to random order, randomized in place.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim N As Long
Dim L As Long
Dim temp As Variant
Dim j As Long
Randomize
L = UBound(InArray) - LBound(InArray) + 1
For N = LBound(InArray) To UBound(InArray)
j = Int((UBound(InArray) - LBound(InArray) + 1) * Rnd + LBound(InArray))
If N <> j Then
temp = InArray(N)
InArray(N) = InArray(j)
InArray(j) = temp
End If
Next N
ShuffleArrayInPlace = InArray
End Function
http://www.mrexcel.com/forum/showthread.php?t=418911
в Гугле стока вариантов