Picture this…
You’re settling down for a game of monopoly… everyone is ready around the board… you’ve exchanged banter and already started to forge alliances… and you realise you don’t have any dice! Somewhere along the last 20 years that you owned the board, the dice got separated from it, eaten by the dog maybe, who knows.
So what now?
Use Excel.
Here it is, your dice-rolling spreadsheet. Just select from the dropdown how many dice you want to roll (up to 6 at a time) and press the button (make sure you have macros enabled first).
If you’re learning VBA, this is a relatively short piece of code for you to investigate. See if you can understand how it works, and think whether you would do it the same way. If not, let me know what your approach would be!
UPDATE!:
We took some good advice and changed our VBA to avoid selecting cells. It simplifies things and with a larger file is more efficient – basically it’s the better approach. Also, if you turn your volume on that it now reads you the numbers as they come up and tells you the total at the end. And another thing, it has a Roll again? dialogue box at the end.
Very cool file!! I liked a lot the use of named ranges/formulas and pictures…
I would modify the code as follows to eliminate some selections:
For i = 1 To Dice
Application.ScreenUpdating = False
Application.Wait Now() + TimeValue(“00:00:01″)
Range(“B6″).Offset(0, i).Value = WorksheetFunction.RandBetween(1, 6)
Application.ScreenUpdating = True
Next i
Orlando Mezquita
Thanks very much Orlando! We’ve followed your good advice and removed selections. You’ll see we also added speech and a Roll again msgbox. Any further feedback welcomed!
Interesting!!!! Very cool!!!!
Thanks Rita! If you liked that then you’ll probably like The Amazing Macro-powered Excel Slide Puzzle!