#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Dice

Need to no how to program dice to randomly generate instead of numbers words
on the click of a button.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Dice

First create the button in the usual way and assign the following macro to it:

Sub dice()
Dim s(6) As String
s(0) = "one"
s(1) = "two"
s(2) = "three"
s(4) = "five"
s(5) = "six"
v = Round(Rnd() * 5)
MsgBox (s(v))
End Sub
--
Gary's Student


"Spud" wrote:

Need to no how to program dice to randomly generate instead of numbers words
on the click of a button.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Dice

Sorry the previous dice were loaded. Use this instead:
Sub dice()
Dim s(6) As String
s(0) = "one"
s(1) = "two"
s(2) = "three"
s(3) = "four"
s(4) = "five"
s(5) = "six"
v = Round(Rnd() * 5)
MsgBox (s(v))
End Sub

--
Gary''s Student


"Spud" wrote:

Need to no how to program dice to randomly generate instead of numbers words
on the click of a button.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dice roll "problem" Markv Excel Discussion (Misc queries) 3 June 12th 08 09:14 AM
How do I mimic random dice rolls in a sheet Markv Excel Discussion (Misc queries) 5 June 12th 08 09:10 AM
Probabilities, random numbers and dice throws Galamdring Excel Worksheet Functions 2 July 21st 05 03:01 PM
programming a dice roll Carl Excel Programming 5 July 20th 05 03:46 AM
Probability of dice throws Darren Hill[_3_] Excel Programming 1 May 17th 05 07:39 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"