Skip to main content

AccessTr.neT


Excel Makro (soru)

haandsomee_tr
haandsomee_tr
10
1387

Excel Makro (soru)

#4
aşağıdaki kodu dener misiniz?
Sub SecmeliRastGele()
Set Rng = ThisWorkbook.Worksheets("ALL_DATA").Range("A1:C10000").SpecialCells(xlCellTypeVisible)

      rowCount = WorksheetFunction.CountA(Rng) / Rng.Columns.Count
    If rowCount <= 10 Then
        ThisWorkbook.Worksheets("ALL_DATA").Range("A1:C10000").SpecialCells(xlCellTypeVisible).Copy Destination:=ThisWorkbook.Worksheets("HedefSayfa").Range("A1")
        Exit Sub
    End If
    Dim dzSecil As Variant
    ReDim dzSecil(1 To rowCount)
 
    i = 0
    For Each xRw In Rng.Rows
    i = i + 1
        dzSecil(i) = xRw.Value2
        If rowCount = i Then GoTo 10
    Next xRw
10
Dim dctIndx As Object: Set dctIndx = CreateObject("Scripting.Dictionary")
    Do While dctIndx.Count < 10
    TmpTrh = Int((rowCount * Rnd) + 1)
        If TmpTrh > 1 Then If Not dctIndx.Exists(TmpTrh) Then dctIndx.Add TmpTrh, 0
    Loop

  Dim dzTmp() As Variant
ReDim dzTmp(0 To dctIndx.Count, 2)
x = 0
        dzTmp(x, 0) = dzSecil(1)(1, 1)
        dzTmp(x, 1) = dzSecil(1)(1, 2)
        dzTmp(x, 2) = dzSecil(1)(1, 3)
For Each Ky In dctIndx.keys
x = x + 1
        dzTmp(x, 0) = dzSecil(Ky)(1, 1)
        dzTmp(x, 1) = dzSecil(Ky)(1, 2)
        dzTmp(x, 2) = dzSecil(Ky)(1, 3)
Next
ThisWorkbook.Worksheets("HedefSayfa").Range("A1").Resize(UBound(dzTmp) + 1, 3) = dzTmp
End Sub
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Excel Makro (soru) - Yazar: haandsomee_tr - 06/06/2024, 18:09
RE: Excel Makro (soru) - Yazar: berduş - 06/06/2024, 21:42
RE: Excel Makro (soru) - Yazar: haandsomee_tr - 07/06/2024, 08:42
RE: Excel Makro (soru) - Yazar: berduş - 10/06/2024, 00:17
RE: Excel Makro (soru) - Yazar: haandsomee_tr - 10/06/2024, 09:14
RE: Excel Makro (soru) - Yazar: berduş - 10/06/2024, 16:06
RE: Excel Makro (soru) - Yazar: haandsomee_tr - 10/06/2024, 16:14
RE: Excel Makro (soru) - Yazar: berduş - 10/06/2024, 16:18
RE: Excel Makro (soru) - Yazar: haandsomee_tr - 10/06/2024, 16:25
RE: Excel Makro (soru) - Yazar: berduş - 10/06/2024, 17:16
RE: Excel Makro (soru) - Yazar: berduş - 10/06/2024, 20:01
Task