+ Reply to Thread
Results 1 to 4 of 4

Extracting 10 random rows from one sheet, and pasting them on another.

  1. #1
    Registered User
    Join Date
    12-08-2009
    Location
    CT
    MS-Off Ver
    Excel 2003
    Posts
    2

    Extracting 10 random rows from one sheet, and pasting them on another.

    Hello Everyone,

    I have 3 worksheets in one workbook. I need to extract 10 random rows of information from about 193 rows in sheet 1, and post it in sheet 2 and I can't seem to find a way to make this happen correctly. Any help with this would be greatly appreciated.

    Thanks

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Extracting 10 random rows from one sheet, and pasting them on another.

    What do you mean by random rows?

  3. #3
    Registered User
    Join Date
    12-08-2009
    Location
    CT
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Extracting 10 random rows from one sheet, and pasting them on another.

    Out of 193 rows of data, I have to create a macro that will randomly select 10 of those rows. Then the macro needs to post these 10 random rows into Sheet 2.

  4. #4
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Akron, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Extracting 10 random rows from one sheet, and pasting them on another.

    Here's a function that will get you started:

    Please Login or Register  to view this content.


    Call it like this:

    Please Login or Register  to view this content.
    The sub shows how to get the first item in this 10 item array.

    Use the array indexes generated to copy those specific rows.

    Use some sort of variable to find the last row in the worksheet you want to copy from and use that as the Upper limit of the random number generator. The lower limit will be the first possible row you want to copy from. 1 if there is no header, 2 if there is a one row header; etc.

    Find the last row of the worksheet you want to paste the data too and paste it.
    Last edited by jrdnoland; 12-08-2009 at 11:24 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1