+ Reply to Thread
Results 1 to 8 of 8

Dice Rolling Button

  1. #1
    Registered User
    Join Date
    01-26-2020
    Location
    Detroit, MI
    MS-Off Ver
    365
    Posts
    3

    Dice Rolling Button

    I am a complete VBA novice and I'm trying to find a way to generate random numbers with a button click.
    Here are the parameters I'm looking for.
    There are multiple cells I want effected with the click of one button.
    I want the button to generate random numbers between 4 and 24 (and possibly subtract 4 from the final result with a minimum outcome of 1)
    I want the button to be disabled after one click, but I want a reset button to set the generated numbers back to 0 and re-enable the random button.

    Help appreciated!

  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: Dice Rolling Button

    Some suggestions you may fund useful:
    1. Our answerers are looking to "help" more often than they are looking to "do an entire project for you for free".
    2. Jump into this project yourself, when you get stuck on ONE specific hurdle, post that ONE item as a forum question.
    3. Show us what you've tried in an attached sample workbook and how it's not working for you. When you're doing the work yourself, just writing out a complete example question in a forum often points you to solution before you even finish posting.
    4. If you can't make any headway at all and no help is forthcoming in the free forum(s), we do have a Commercial Services forum where you can pay for assistance directly from our EF gurus."

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

    Re: Dice Rolling Button

    I agree with Pepe

    However even to try and give an answer we are missing information to try and hep such as

    Subtract 4 from the outcomes and have a minimum of 1 when value is between 4 and 24?
    Do you want just whole numbers?
    If yes does 4 have an equal chance to appear as say 5 or 6?
    can numbers appear more than once?
    How many numbers are required?

  4. #4
    Registered User
    Join Date
    01-26-2020
    Location
    Detroit, MI
    MS-Off Ver
    365
    Posts
    3

    Re: Dice Rolling Button

    Oh, awesome. I didn't see the paid service option, thanks for pointing that out.

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Dice Rolling Button

    Is this the sort of solution you are looking for ?
    Just a guess as spec was a bit vague.
    It generates six random numbers between 4 to 24, with no duplicates.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-26-2020
    Location
    Detroit, MI
    MS-Off Ver
    365
    Posts
    3

    Re: Dice Rolling Button

    That is actually very close to what I'm looking for, but with duplicates allowed. What line determines whether or not duplicates are allowed?. I think I could work with this to make it fit my needs. Very much appreciated!

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

    Re: Dice Rolling Button

    The below code would generate 6 random numbers with duplication
    Please Login or Register  to view this content.

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Dice Rolling Button

    Code added, also extra lines in previous code.
    Attached Files Attached Files

+ 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] Organizing 'slice and dice'
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-23-2017, 08:19 AM
  2. [SOLVED] Formula for Numbers of Dice
    By jarheadmartian in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-21-2016, 04:52 PM
  3. Replies: 13
    Last Post: 03-19-2016, 12:02 PM
  4. [SOLVED] Dice Rolling Excel Spreadsheet
    By mosswood17 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-03-2012, 03:36 PM
  5. Random numbers of a dice
    By Robins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-03-2010, 08:03 AM
  6. [SOLVED] Z Chart i.e. top rolling annual bottom rolling monthly middle ***.
    By wat prin in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-28-2005, 02:06 PM

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