+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : Random numbers and static numbers

  1. #1
    Registered User
    Join Date
    10-30-2007
    Posts
    6

    Random numbers and static numbers

    Ok here is what I am looking to do. I am using
    randbetween(1,A5) *lets say the output is 5*
    now I change the number in b25 the random number above will change.

    Is there a way that I can get a random number, then keep that number static? I want a random number but once generated I don't want it to change if that makes any sence.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Re: Random numbers and static numbers

    You have a couple options, but the short answer is you cannot use the RAND or RANDBETWEEN functions as you are describing.

    1. (non-VBA) After entering the formula and obtaining the random number, copy and paste special > values the new number.

    2. (VBA) You can use a VBA user-defined function that changes the random number into a static number.

    Please Login or Register  to view this content.
    Then the formula you would use would be =RandNum(1,A5)

    3. (VBA) You can use a worksheet change event macro that changes the random number into a static number. For example, assuming you enter the RANDBETWEEN formula in column A, you can use:

    Please Login or Register  to view this content.
    HTH,
    Jason

  3. #3
    Registered User
    Join Date
    10-30-2007
    Posts
    6

    Re: Random numbers and static numbers

    thanks. I will try those

    ------------------
    edit: The vba worked like a charm. thank you very much
    Last edited by ugsquish; 07-06-2009 at 05:20 PM.

  4. #4
    Registered User
    Join Date
    01-17-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Random numbers and static numbers

    I would like to do the same thing that is discussed here, but do not understand VBA or how to make a user-defined function. Can someone explain this process to me in easy to understand terms? Thanks.

+ 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