+ Reply to Thread
Results 1 to 7 of 7

RAND VBA code build on itself?

  1. #1
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    RAND VBA code build on itself?

    Hello,

    Here is my code:

    Please Login or Register  to view this content.
    What I need to know, is how to make cell C3 build on itself, for example, every time the macro is run, the random # is randomly added or subtracted

    i.e.

    C3 = 1 the macro increases 1 by 2.3456 to equal 3.3456
    the macro is run again and it (randomly adds or subtracts) by 2.3456
    Now C3 = 1
    Last edited by Rick-O-Shay; 01-06-2011 at 11:44 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: RAND VBA code build on itself?

    Maybe ...
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: RAND VBA code build on itself?

    That is great! But I need the number to be randomly positive or negative. Any ideas on that? So that the number in the cell will go both up and down.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: RAND VBA code build on itself?

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: RAND VBA code build on itself?

    SHG, your the BEST! Now 1 last question on the matter Is there any way to make it so that

    1. Cell C3 never goes below 0

    and

    2. There is a slightly higher (lets say 55%) chance that the random # will be positive instead of negative?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: RAND VBA code build on itself?

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: RAND VBA code build on itself?

    You the man shg.

+ 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