اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الردود الموصى بها

قام بنشر
Sub Test()
    Dim v, x, arr, ws As Worksheet, sh As Worksheet, p As Single, l As Long, lr As Long, ii As Long, k As Long
    Set ws = ThisWorkbook.Worksheets("Sheet1")
    Set sh = ThisWorkbook.Worksheets("Sheet2")
    p = 0.1
    lr = ws.Range("A" & Rows.Count).End(xlUp).Row
    v = ws.Range("A1").Resize(lr).Value2
    ReDim w(1 To UBound(v) * p, 0)
    ReDim arr(1 To Int(UBound(v) * p), 1 To 7)
    For l = 1 To UBound(w)
        w(l, 0) = v(Application.RandBetween((l - 1) * 1 / p + 1, l * 1 / p), 1)
        x = Application.Match(Val(w(l, 0)), ws.Columns(1), 0)
        If Not IsError(x) Then
            k = k + 1
            For ii = LBound(arr, 2) To UBound(arr, 2)
                arr(k, ii) = ws.Cells(x, ii).Value
            Next ii
        End If
    Next l
    sh.Range("A1").Resize(UBound(arr, 1), UBound(arr, 2)).Value = arr
End Sub

 

قام بنشر

You can use a helper column to put the results of the code posted here then simply copy the first 20 record to the first table and copy the second 20 record to the second

table

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information