ich habe in einer spalte einige worte stehen, welche ich sortieren lassen will - nur dieses sortieren soll "randomized" sein, d.h. es soll per zufall angeordnet werden
hat da jemand eine idee wie ich das bewerkstellige?
mfg patrick
Sub Vermischen()
Dim collTrommel As Collection
Dim lngRowLast As Long
Dim lngIndex As Long
Dim lngAnzahl As Long
Dim lngKey As Long
lngRowLast = Cells(Rows.Count, 3).End(xlUp).Row
Set collTrommel = New Collection
For lngKey = 2 To lngRowLast
collTrommel.Add CStr(Cells(lngKey, 3)), CStr(lngKey)
Next
lngKey = 2
lngAnzahl = collTrommel.Count
Do While lngAnzahl > 0
lngIndex = (Int(lngAnzahl * Rnd) + 1)
Cells(lngKey, 4) = collTrommel.Item(lngIndex)
collTrommel.Remove lngIndex
lngKey = lngKey + 1
lngAnzahl = lngAnzahl - 1
Loop
End Sub