+ Reply to Thread
Results 1 to 4 of 4

generate random numbers in random range vba

  1. #1
    Registered User
    Join Date
    01-16-2020
    Location
    Beirut
    MS-Off Ver
    2016
    Posts
    17

    generate random numbers in random range vba

    Hi I'm trying to generate randbetween(1,6) notduplicated for each ID, the last two cells of each ID must have value too (range of size for generating random numbers is from 2 to 6) sth. like this:
    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: generate random numbers in random range vba

    Provided
    - your IDs are in column A (starting row 2)
    - generated users are to be displayed in column B.
    - IDs are sorted (as in example)
    - by "range of size for generating ..." you meant number of identical IDs
    - if there is more than 2 identical IDs, 3 unique users numbers are to be generated
    Such code shall do the work:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    01-16-2020
    Location
    Beirut
    MS-Off Ver
    2016
    Posts
    17

    Re: generate random numbers in random range vba

    Quote Originally Posted by Kaper View Post
    Provided
    - your IDs are in column A (starting row 2)
    - generated users are to be displayed in column B.
    - IDs are sorted (as in example)
    - by "range of size for generating ..." you meant number of identical IDs
    - if there is more than 2 identical IDs, 3 unique users numbers are to be generated
    Such code shall do the work:

    Please Login or Register  to view this content.
    thanks for Your answer, your code is so useful

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: generate random numbers in random range vba

    Glad to see it worked, and thanks for marking thread SOLVED and for reputation point.

    PS. As there was only one answer, I believe Forum Guideline no.2 (posted below forum rules in : https://www.excelforum.com/forum-rul...rum-rules.html ) shall apply here :-)

+ 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. Random, but not quite random... I'd like to generate combos with set rules...
    By LottoLinks in forum Excel Formulas & Functions
    Replies: 38
    Last Post: 01-05-2019, 08:46 PM
  2. Replies: 1
    Last Post: 02-20-2018, 06:56 AM
  3. Generate unique random numbers within range and input in desired cell
    By acronymm in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-04-2015, 03:44 AM
  4. [SOLVED] how to generate random numbers in range 1:20 with unique results
    By jmac1947 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-23-2014, 08:54 AM
  5. [SOLVED] Generate random 6-16-byte random hexadecimal number
    By jsamuelshn in forum Excel General
    Replies: 6
    Last Post: 07-20-2012, 10:38 AM
  6. Generate random non-repeated range of numbers?
    By satoshi in forum Excel General
    Replies: 2
    Last Post: 06-17-2009, 05:32 AM
  7. Using VBA to generate random numbers
    By matt3542 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2008, 09:15 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