P
Preschool Mike
Is it possible to generate 12 random numbers (numbers 1 - 12) independently
(no numbers repeated) in 12 independent shapes (one number per shape) by the
click of a single button? I can come up with the code to generate 12 random
numbers, but with my code there's always the chance that some of the numbers
will be the same (repeated). I want them all to be different and from 1 to
12. Here's a shortened example of what I'm using.
Dim First As Integer
Dim Second As Integer
Dim Third As Integer
Sub Initalize()
Randomize
First = 0
Second = 0
Third = 0
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub RandomNumber()
First = Int((12 - 1 + 1) * Rnd + 1)
Second = Int((12 - 1 + 1) * Rnd + 1)
Third = Int((12 - 1 + 1) * Rnd + 1)
ActivePresentation.Slides(2).Shapes("Box1").TextFrame.TextRange.Text = First
ActivePresentation.Slides(2).Shapes("Box2").TextFrame.TextRange.Text = Second
ActivePresentation.Slides(2).Shapes("Box3").TextFrame.TextRange.Text = Third
End Sub
Thanks,
(no numbers repeated) in 12 independent shapes (one number per shape) by the
click of a single button? I can come up with the code to generate 12 random
numbers, but with my code there's always the chance that some of the numbers
will be the same (repeated). I want them all to be different and from 1 to
12. Here's a shortened example of what I'm using.
Dim First As Integer
Dim Second As Integer
Dim Third As Integer
Sub Initalize()
Randomize
First = 0
Second = 0
Third = 0
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub RandomNumber()
First = Int((12 - 1 + 1) * Rnd + 1)
Second = Int((12 - 1 + 1) * Rnd + 1)
Third = Int((12 - 1 + 1) * Rnd + 1)
ActivePresentation.Slides(2).Shapes("Box1").TextFrame.TextRange.Text = First
ActivePresentation.Slides(2).Shapes("Box2").TextFrame.TextRange.Text = Second
ActivePresentation.Slides(2).Shapes("Box3").TextFrame.TextRange.Text = Third
End Sub
Thanks,