Gruppe
Allgemein
Problem
Wie kann ich eine Liste mit Werten nach dem Zufallsprinzip umsortieren?
StandardModule: basMain
Sub Zufall()
Dim rngA As Range
Dim iRow As Integer, iZufall As Integer
Randomize
iRow = Selection.Rows.Count
Columns(2).ClearContents
For Each rngA In Selection.Cells
iZufall = Int((iRow * Rnd) + 1)
Do While Not IsEmpty(Cells(iZufall, 2))
iZufall = Int((iRow * Rnd) + 1)
Loop
Cells(iZufall, 2).Value = rngA.Value
Next rngA
End Sub