Random number

  • Thread starter Thread starter Alec Stonehouse
  • Start date Start date
A

Alec Stonehouse

HI Group,

I want PPT to generate a random number (between 1 and 20) on a buton click.
I have never tried using VBA and suspect this is the only way to do it.
If a kind person has any ideas and lots of patience, I would love to hear
from you.

thanks in advance

Alec
 
I'd just link to excel and use it's random number generato
e.g put "=RANDBETWEEN(1,20)" in a cell, and then hit F
a few times
Just use autoshape to create the button
Rightclick the button and select hyperlink/to other file/ an
select the name of your excel file
2 problems here
1) the excel file will look lousy compared to the powerpoint fil
But you can spend some time formating and sizing it to your need
(and then save it.
2) You'll get the same series of "random numbers" every tim
you open the file UNLESS you save the results. So unless you sav
your audience will start thinking that the numbers are not very random
Probably almost all random number generators you might run int
would have the same problem though.
 
The random number generator in excel works fairly well.
I dont get the 'randbetween' option, only 'rand'.
However, it does seem to give a unique number each time you run it.

It would be much better if I could get ppt to do it.
Any more thoughts????
 
HI Group,

I want PPT to generate a random number (between 1 and 20) on a buton click.
I have never tried using VBA and suspect this is the only way to do it.
If a kind person has any ideas and lots of patience, I would love to hear
from you.

Sub MakeARandomNumber()

Dim MaxNumber As Long

' Edit this to be the highest number you're willing to accept
MaxNumber = 42

Randomize ' Initialize random-number generator.
MsgBox (Int(MaxNumber * Rnd) + 1)

End Sub

That's the code. Have a read here to learn ... er ... where to stick it. ;-)

How do I USE this VBA stuff in PowerPoint?
http://www.rdpslides.com/pptfaq/FAQ00033.htm
 
Back
Top