DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub kod()
sat = Selection.Row
tekrar:
ra = WorksheetFunction.RandBetween(21, 90)
If Cells(sat, ra) <> "" Then
If Not d Like "*" & ra & "*" Then
Cells(sat, ra).Select
Exit Sub
Else
d = d & "#" & ra
End If
End If
GoTo tekrar
End Sub
Hocam bu kodu denedim fakat dolu hücrelerde rastgele seçim yapmıyor. Aşağıdaki kodu Yusuf bey paylaşmıştı ve kodun amacı belirtilen aralıktaki satırda boş hücre olan ve değeri "+" olmayan hücreleri rastgele seçmek. Aynı bu kodu yine değeri "+" olmayan, dolgu renksiz olan ve bu defa dolu olan hücrelerde ve en önemlisi aktif satırda çalıştırabilir miyiz?.
.Kod:Sub kod() sat = Selection.Row tekrar: ra = WorksheetFunction.RandBetween(21, 90) If Cells(sat, ra) <> "" Then If Not d Like "*" & ra & "*" Then Cells(sat, ra).Select Exit Sub Else d = d & "#" & ra End If End If GoTo tekrar End Sub
Hocam son mesajıma (3 nolu) bakabildiniz mi?.
.Kod:Sub kod() sat = Selection.Row tekrar: ra = WorksheetFunction.RandBetween(21, 90) If Cells(sat, ra) <> "" Then If Not d Like "*" & ra & "*" Then Cells(sat, ra).Select Exit Sub Else d = d & "#" & ra End If End If GoTo tekrar End Sub
Sub deneme10()
With Application
.Calculation = xlManual
.ScreenUpdating = False
.EnableEvents = False
End With
sat = ActiveWindow.RangeSelection.Row
say2 = 0
For i = 21 To 90
atla1:
say = Int((Rnd * 90) + 1)
say2 = say2 + 1
If say2 = 2000 Then MsgBox "hiç veri yok": GoTo atla2
If Cells(sat, say) = "" Then GoTo atla1
If say < 20 Then GoTo atla1
If Cells(sat, say) = "+" Then GoTo atla1
MsgBox Cells(sat, say)
MsgBox say
Exit For
Next i
atla2:
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlAutomatic
End With
MsgBox "işlem tamam"
End Sub
Sub aktifSatirAraliktanDolgusuzNegatifSec()
Dim col As New Collection
On Error GoTo uygunYok
Set Rng = Intersect(Rows(ActiveCell.Row).SpecialCells(xlCellTypeConstants, 1), Range("u:cl"))
For Each cell In Rng
If cell.Value < 0 And cell.Interior.ColorIndex = xlNone Then col.Add cell
Next
If col.Count > 0 Then
col(WorksheetFunction.RandBetween(1, col.Count)).Select
Else
GoTo uygunYok
End If
Exit Sub
uygunYok:
On Error Resume Next
MsgBox "Uygun Hücre Yok"
End Sub
Alternatif olarak bu kodu bir dene
......
....