+ Reply to Thread
Results 1 to 8 of 8

Finding a random row and paste it in Sheet2

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    Finding a random row and paste it in Sheet2

    Hello,

    In Sheet1, I have a string of Rows from A to AZ column. I want a VBA code which would randomly pick up 5% of the total rows and paste it in Sheet2.
    How can we do that?

    fyi.. Everytime I run this macro, I want new random rows to be picked up and placed in Sheet2.

    Thanks,
    Shiva
    Keep the Forum clean :


    1. Use [ code ] code tags [ /code ]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. Show appreciation to those who have helped you by clicking * Add Reputation below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Finding a random row and paste it in Sheet2

    Hi Shiva,

    Try this:

    Please Login or Register  to view this content.
    Last edited by xladept; 06-10-2014 at 02:36 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    Re: Finding a random row and paste it in Sheet2

    Very nice... Thanks a lot.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Finding a random row and paste it in Sheet2

    You're welcome and thanks for the rep!

    Oops! I found an error - use this instead:

    Please Login or Register  to view this content.
    Last edited by xladept; 06-10-2014 at 02:56 PM.

  5. #5
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    Re: Finding a random row and paste it in Sheet2

    hey, if i want to increase the percentage.. Say 62%. how would I do that?

  6. #6
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    Re: Finding a random row and paste it in Sheet2

    one more thing I just noted. Why it is capturing 20% of total row and not 5%?

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Finding a random row and paste it in Sheet2

    Hi Shiva,

    My bad, I should have multiplied:
    Please Login or Register  to view this content.
    Just put the percentage (5% as .05 etc) where the red is.

  8. #8
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    713

    Re: Finding a random row and paste it in Sheet2

    Thanks!!! It helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Posting select random numbers between Sheet1 and Sheet2
    By BadWolfBay75 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2014, 10:55 PM
  2. macro for finding values in sheet2 and printing it in sheet1
    By meezadahsra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2013, 04:42 AM
  3. macro for finding values in sheet2 and printing it in sheet1
    By meezadahsra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2013, 05:32 AM
  4. Finding Active Row in sheet1 from sheet2
    By mrall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2012, 11:26 AM
  5. Find random variable from sheet1, in sheet2, and copy entire row to sheet3
    By TMorville in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-12-2010, 06:27 AM

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