+ Reply to Thread
Results 1 to 4 of 4

"Do Until Matches Criteria"-Loop Thru Randomised Range, With Counter

  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    Somerset West, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    16

    Cool "Do Until Matches Criteria"-Loop Thru Randomised Range, With Counter

    Hi.
    I need to create a macro that will firstly create a random (=RAND ()) range of numbers (e.g. between 0-20), then repeatedly randomise these numbers (F9) until, let's say, 5 of them match 5 other numbers (within the same range) specified in a separate row (i.e. "do until" loop, until criteria are met), while at the same time counting the number of times it repeats the loop until it matches the criteria. Upon matching the criteria, it must show the resultant number of loops (F9's) in a separate cell. It must then repeat the procedure for subsequent rows until it reaches an empty row of cells.
    Any ideas greatly appreciated.
    Attached Files Attached Files
    Last edited by GUERCHARD; 06-23-2013 at 03:03 PM. Reason: example excel file added

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: "Do Until Matches Criteria"-Loop Thru Randomised Range, With Counter

    suppose range is only column range A1 to A25
    quote
    5 of them match 5 other numbers (within the same range)
    unquote
    explain this with example so that I can attept.

    for filling the above range with random nos. this is the macro

    Please Login or Register  to view this content.
    I am not an expert. better solutions may be available
    [email protected]

  3. #3
    Registered User
    Join Date
    08-21-2012
    Location
    Somerset West, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: "Do Until Matches Criteria"-Loop Thru Randomised Range, With Counter

    I apologise for my first submission. Even to me it appears a bit confusing. Attached please find an excel file with which I attempt to explain what I want to achieve. Ultimately I want a macro that counts how many times I have to press the F9-button until a random numbers row match the fixed numbers row. Hope this helps.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-21-2012
    Location
    Somerset West, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: "Do Until Matches Criteria"-Loop Thru Randomised Range, With Counter

    Macro to count how many times a range of numbers is randomised.
    Attached Files Attached Files

+ 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