Guess my number game for kids.

H

Honey

Hi all,

I could do with some help please. I want to create a game for my
Primary school class to play.

I want Excel to generate a random number( between 1 and 100) and then
for the children to enter guesses as the number and excel to return
the answers too high, too low and correct..... I think I am ok with
doing this but I want to keep track of how many attempts they need to
find the number. Does anyone know if Excel is able to do this and how?

Thanks very much and I hope you all have an excellent easter.

Honey
 
S

Susan

hello!
yes, you can do this with a macro, easily.
first you'd neet to select the random number and display it in the
correct cell (lock it so the kids can't mess it up).
then you'd have to name the cell in which they are entering their
guesses.
you'd have to have a worksheet_change routine that instantly checks
their guess against the random number & displays the correct
response: "Number is too high!" or "Number is too low!" or "Yes!
That's it!".
then you'd need one other cell to the side that adds 1 (+1) to that
counter every time they guess a number..... that would also have to
reset to 0 when they do get the correct number.
so the counter would have to be a worksheet_change macro connected to
that specific cell, upon exiting that cell (or hitting "enter") it
would run & update the number.
hope this gives you some ideas
susan
 
M

Mike

I've only addressed your latter point because you say your OK with the rest
so counting guesses is easy. Right click the sheet tab with your game in and
paste this code in

Private Sub Worksheet_Calculate()
Cells(1, 4).Value = Cells(1, 4).Value + 1
End Sub

It uses D1 so you may wish to change it. Reset the number when the children
get the correct answer by manually changing it to zero. Excel won't interpret
this as a reclaculate and set it to 1.

Mike
 
H

Honey

Thanks for your quick reply - I don't know much about Macros - now
seems like a good time to learn!
I will give it a go!

Regards,
Honey
 
S

Susan

see, i told you "programming" could help. :)
merjet's idea was closer to mine than okrobs - you said "primary"
grades so i was trying to have as little clicking of buttons as
possible & as much automatic stuff as possible......... mothers
understand that kind of stuff!
<visions of 8-year-old clicking buttons here there & everywhere!>
:)
susan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top