Alternatif;
C kolonunu yardımcı olarak kullanıp temizler.
Kod:Sub karistir() Application.ScreenUpdating = False sonsatir = Cells(Rows.Count, "A").End(3).Row ustsayi = sonsatir: altsayi = 1 Range("C1:C" & sonsatir).Clear For i = 2 To sonsatir basla: DoEvents: Randomize sayi = Int((ustsayi - altsayi + 1) * Rnd + altsayi) If WorksheetFunction.CountIf(Range("C1:C" & sonsatir), sayi) > 0 Then GoTo basla If sayi = altsayi Then altsayi = sayi + 1 If sayi = ustsayi Then ustsayi = sayi - 1 Cells(i, "C").Value = sayi Next i Range("A:C").Sort Key1:=Cells(1, "C"), Order1:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Columns("C:C").ClearContents Range("B1").Select Application.ScreenUpdating = True MsgBox ("Karıştırma işlemi tamamlandı.") End Sub
Asri Hocam,
Bu kod sanki 1 satıra karışmıyor.
2. satırdan itibaren karıştırma yapıyor.
Ben de bu kodu arıyordum.
