+ Reply to Thread
Results 1 to 7 of 7

Random Numbers (predefined range)

  1. #1
    Registered User
    Join Date
    02-09-2020
    Location
    Seoul
    MS-Off Ver
    2016
    Posts
    15

    Random Numbers (predefined range)

    Hello.
    I'm a newbie to excel and was wondering if I can get some help changing my excel formula to a VBA macro for my workbook as the randbetween function in excel recalculates all my numbers each time the workbook is updated.
    I've attached my project, the orange (height)columns is where I need the randoms numbers to be generated.
    Any help would be super appreciated.
    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Random Numbers (predefined range)

    Administrative note
    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version. AFAIK there is no XL2014
    Thanks

  3. #3
    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,616

    Re: Random Numbers (predefined range)

    Hope the above administrative note does not block the possibility to give some insight. But please before you answer below question, do follow the administrator request.

    What are the rules to set random between limits. In most of cells you have RANDBETWEEN(5, 6) but for instance in whole row 3 the limits are 5 to 7, in row 4 limits are 6 to 8 (but cell E4 where it's between 7 and 8). etc.
    Best Regards,

    Kaper

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Random Numbers (predefined range)

    You could do a macro if you really needed

    I would put the below formula some where and then past into cell d2 as text and copy down and across
    =IF($C2>=COLUMN(A1), RANDBETWEEN(5, 6),"")

    then copy and paste as values on top of the data to make it static


    if you really wanted a macro

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-09-2020
    Location
    Seoul
    MS-Off Ver
    2016
    Posts
    15

    Re: Random Numbers (predefined range)

    Hi.
    I updated my profile as requested. Thanks for the tip.

  6. #6
    Registered User
    Join Date
    02-09-2020
    Location
    Seoul
    MS-Off Ver
    2016
    Posts
    15

    Re: Random Numbers (predefined range)

    Hello.
    I'm still working on the workbook. The column "quantity" is where I would put how many cells would be filled under the "heights" column. The random number range would probably go up in threes ie; circumference of 6 would generate numbers between 5-7, 8: 6-9, 10:8-11, 12:10-12 and so on.

  7. #7
    Registered User
    Join Date
    02-09-2020
    Location
    Seoul
    MS-Off Ver
    2016
    Posts
    15

    Re: Random Numbers (predefined range)

    Hi.
    Really appreciate your help. Just that if I run your macro all cells under height gets filled with all 5 or 6 and not randomly. Also column 'quantity is there to tell how many cells should be filled the heights columns. For example if quantity is 3 then only 3 cells would be filled with random numbers if quantity is 24 the all 6 cells in column heights would be filled. Hope you understand my question. Thank you again for your help.

+ 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] generate random numbers in random range vba
    By hsnfifo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-20-2020, 12:59 PM
  2. Random populate sheet with predefined information
    By Stingone in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-15-2014, 09:34 AM
  3. random predefined amount of names formula
    By miller_ilya in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-12-2013, 02:56 PM
  4. [SOLVED] Random Numbers in a Named Range
    By JonesZoid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2013, 03:54 PM
  5. Random numbers in range
    By hockey123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2010, 11:22 PM
  6. VBA - random select from predefined range
    By newmisslesylo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2009, 01:13 PM
  7. [SOLVED] Unique RANDOM NUMBERS within specified range
    By Matt D Francis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-09-2006, 09:40 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