Jean's concept is okay to start with, but the details are missing,
you want the questions to be random. Here is another solution
in addition to those that you will already find on the Google Groups search.
There is only one worksheet involved. It would be up to the student
to clear out the answers when they want to really start over. A zero
allows you to terminate and continue at a later time.
You can start the Multiplication quiz game with a double click
and be asked for the answer of a multiplication
if the answer is incorrect the question is repeated.
When correct another multiplication is chosen at random.
As set up the multiplication goes up to 12 x 12
You can change the Random number ranges and the
Cell ranges if you want something more or less.
alternate method:
You can type in the answer of a multiplication of Row * Column
if the answer is incorrect the reply turns RED
Here a couple of Event Macros. Install with a rightclick on the
worksheet tab, view code, ....
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'D.McRitchie, 2004-09-12
'
http://groups.google.com/[email protected]
Dim x As Integer, y As Integer, z As Integer, results As Integer
Dim msg As String, xZ As String, rng2 As Range, xx As String
msg = "game started"
results = 0
nextM:
x = Int((12 * Rnd) + 1)
y = Int((12 * Rnd) + 1)
If Cells(y, x) = x * y Then GoTo nextM
xZ = ""
retry:
On Error GoTo retry
z = InputBox("What is the value of " & x & " X " & y, msg)
On Error GoTo 0
If z = 0 Then
MsgBox "Game Over, Double Click to continue"
Exit Sub
Else
If z = x * y Then
Cells(x, y) = x * y
Cells(x, y).Font.ColorIndex = 1
Cells(y, x) = x * y
Cells(y, x).Font.ColorIndex = 1
results = results + 2
msg = "I'm asking you..."
On Error Resume Next
xx = Range("A1:L12").SpecialCells(xlCellTypeBlanks).Address
If Err.Number <> 0 Then
MsgBox "completed, Game over"
Exit Sub
End If
On Error GoTo 0
GoTo nextM
Else
MsgBox z & "is incorrect, Try again"
GoTo retry
End If
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(Target.Row, Target.Column) <> Target.Row * Target.Column Then
Target.Font.ColorIndex = 3
Else
Target.Font.ColorIndex = 1
End If
End Sub