DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub test_dagit()
Dim atama As Worksheet, liste As Worksheet, lson As Long, satir As Long, i As Byte, s As Byte
Set atama = Sayfa1
Set liste = Sayfa2: lson = liste.Range("A" & Rows.Count).End(3).Row
s = 2
1:
For i = 3 To 12
2:
satir = WorksheetFunction.RandBetween(2, lson)
If liste.Range("C" & satir) <> "+" Then
atama.Cells(i, s) = liste.Range("A" & satir)
atama.Cells(i, s + 1) = liste.Range("B" & satir)
liste.Range("C" & satir) = "+"
Else
say = WorksheetFunction.CountIf(liste.Range("C2:C" & lson), "+")
If say = lson - 1 Then
GoTo bitir
Else
GoTo 2
End If
End If
If i = 12 Then
ss = atama.Cells(2, Columns.Count).End(1).Column
If s + 1 = ss Then GoTo bitir
grup = atama.Cells(1, s)
soru = MsgBox(grup & " tamamlandı, diğer gruba geçmek ister misiniz?", vbQuestion + vbYesNo, "")
If soru = vbYes Then
s = s + 2: GoTo 1
End If
End If
Next
bitir:
Set atama = Nothing: Set liste = Nothing
lson = 0: satir = 0: s = 0: i = 0
End Sub