Results 1 to 7 of 7

RAND VBA code build on itself?

Threaded View

  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:

    
    Sub myRand()
       With Range ("C3")
               .Formula = "=RAND()*2"
               .Value = .Value
       End With
    End Sub
    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.

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