- Katılım
- 29 Nisan 2009
- Mesajlar
- 5
- Excel Vers. ve Dili
- 2007
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub Yerlestir()
Dim Bayrak As Boolean
Dim i As Integer
Dim Sat As Integer
Dim GorevAdet As Integer
GorevAdet = [D65536].End(3).Row - 1
Application.ScreenUpdating = False
Range("E2:F" & GorevAdet + 1).ClearContents
Range("A2:B" & [A65536].End(3).Row).Interior.ColorIndex = xlNone
For i = 2 To [A65536].End(3).Row
Bayrak = True
Do
Randomize
Sat = Int((GorevAdet * Rnd) + 1)
If Cells(Sat + 1, "E") = "" Then
Cells(Sat + 1, "E") = Cells(i, "A")
Cells(i, "A").Interior.ColorIndex = 14
Bayrak = False
End If
Loop While Bayrak = True
Bayrak = True
Do
Randomize
Sat = Int((GorevAdet * Rnd) + 1)
If Cells(Sat + 1, "E") <> "" And Cells(Sat + 1, "F") = "" Then
Cells(Sat + 1, "F") = Cells(i, "B")
Cells(i, "B").Interior.ColorIndex = 40
Bayrak = False
End If
Loop While Bayrak = True
Next i
Application.ScreenUpdating = True
End Sub
Sub HücreSeç()
Dim hcr As Variant, hfz As Variant
Dim Aralik As Range, hdf As Range
Dim x As Long, sayi As Long
Set Aralik = Range("b3:b" & [g65536].End(3).Row)
Set hdf = Range("h3:h" & [g65536].End(3).Row)
For i = 1 To 2
hcr = Aralik
Randomize
For x = 1 To UBound(hcr, 1)
sayi = Int(Rnd() * UBound(hcr) + 1)
hfz = hcr(x, 1)
hcr(x, 1) = hcr(sayi, 1)
hcr(sayi, 1) = hfz
Next x
hdf = hcr
Set Aralik = Range("d3:d" & [g65536].End(3).Row)
Set hdf = Range("I3:I" & [g65536].End(3).Row)
Next
MsgBox "Kura çekimi tamamlanmıştır.", vbInformation, "leumruk"
End Sub
Necdet bey. Yaptığınız kodları adım adım anlatabilir misiniz?