# Multiplication Quiz in Excel

An Example of a student multiplication Table Quiz up to 12 x 12
Location: http://www.mvps.org/dmcritchie/excel/multiplyquiz.htm
[View without Frames]

## Multiplication Quiz

• To clear table to start over use Right Click in any cell.  The worksheet will be cleared and the row and column numbers will be filled in so they can be seen (A1:L1 and A1:A12).
• Prompt mode:  If you would like to be prompted for an answer start by double clicking anywhere on the worksheet.  A reply of zero (the 0 digit) will terminate the quiz and you can continue at a later time by starting with a double click; otherwise, you will be prompted for answers until the table is filled in.  An incorrect response will retry same request.  Questions will be asked in random order.
• To type in a reply on your own, pick a cell and type your answer, the answer will turn RED if it is incorrect, and will turn Black when correctly entered.
 A B C D E F G H I J K L 1 1 2 3 4 5 6 7 8 9 10 11 12 2 2 4 6 8 10 12 14 16 18 20 22 24 3 3 6 9 12 15 18 21 24 27 30 33 36 4 4 8 12 16 20 24 28 32 36 40 44 48 5 5 10 15 20 25 30 35 40 45 50 55 60 6 6 12 18 24 30 36 42 48 54 60 66 72 7 7 14 21 28 35 42 49 56 63 70 77 84 8 8 16 24 32 40 48 56 64 72 80 88 96 9 9 18 27 36 45 54 63 72 81 90 99 108 10 10 20 30 40 50 60 70 80 90 100 110 120 11 11 22 33 44 55 66 77 88 99 110 121 132 12 12 24 36 48 60 72 84 96 108 120 132 144

To start the Multiplication quiz game start with a right click to clear the table.  To be prompted for answers Double Click on any cell.  to start.  Terminate quiz with a 0 (zero).  If you prefer you can select a cell and type in the answer.

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.

Here are three 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
Dim x As Long, y As Long, z As Long, results As Long
Dim msg 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
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
On Error Resume Next
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

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cells.Clear
Dim i As Long
For i = 1 To 12
Cells(1, i) = i
Cells(i, 1) = i
Next i
Range("1:1").Font.Bold = True
Range("A:A").Font.Bold = True
End Sub

```

Excel questions not directly concerning my web pages are best directed to newsgroups
such as
news://msnews.microsoft.com/microsoft.public.excel.misc where Excel users all around the clock from at least 6 continents ask and answer Excel questions.  Posting suggestions and netiquette.  More information on newsgroups and searching newsgroups.    Google Groups (Usenet) Advanced Search Excel newsgroups (or search any newsgroup).