hab mal nue kurze Frage:
Das hier per Recherche gefunden, aber wie kann man es abgrenzen das er sich einfach nur 30 oder per Angabe zufällige Nummern aus der Liste wählt?
Option Explicit
Sub ZufallsNamen() Dim rng As Range Dim var As Variant Dim intRowAll As Integer, intCell As Integer, intCol As Integer Dim intRow As Integer, intAct As Integer Dim strName As String Columns("B:IV").ClearContents var = InputBox("Anzahl Gruppen:", , 3) If var = "" Then Exit Sub If Not IsNumeric(var) Then Exit Sub For intCol = 1 To CInt(var) Cells(2, intCol + 2) = "Gruppe" & CStr(intCol) Next intCol Randomize intRowAll = Range("A1").CurrentRegion.Rows.Count intRow = 3 intCol = 3 For intCell = 1 To intRowAll intAct = Int((intRowAll * Rnd) + 1) strName = Cells(intAct, 1).Value Set rng = Range("C2").CurrentRegion.Find(strName, lookat:=xlWhole, LookIn:=xlValues) Do While Not rng Is Nothing intAct = Int((intRowAll * Rnd) + 1) strName = Cells(intAct, 1).Value Set rng = Range("C2").CurrentRegion.Find(strName, lookat:=xlWhole, LookIn:=xlValues) Loop Cells(intRow, intCol) = strName intCol = intCol + 1 If IsEmpty(Cells(2, intCol)) Then intRow = intRow + 1 intCol = 3 End If Next intCell End Sub Danke und Gruß
Thorben