+ Reply to Thread
Results 1 to 3 of 3

Set Macro to Run Randomly

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Set Macro to Run Randomly

    Can anyone tell me how to set a portion of a macro to run only every 50 times. Or even just completely randomly. This could work wonderfully for having archives save every once in a while, or just playing random jokes on people at the office.

    Here's my attempt at something I don't know how to do.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Set Macro to Run Randomly

    Declare a Static variable in the procedure... Increment every time the procedure runs.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Ventura, united States
    MS-Off Ver
    Excel 2010
    Posts
    346

    Re: Set Macro to Run Randomly

    That looks great. Can you explain it at all to me. So does RND mean pick any random number? I don't really understand where it is that you define iRuns. Is iRuns the count of how many times I've run the macro?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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