Dice

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Need to no how to program dice to randomly generate instead of numbers words
on the click of a button.
 
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
 
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
 
Back
Top