Hi all,
For checking the answer to a multiple choice quiz, I wrote a subroutine. See below.
(Undefined variables and FaultArray() are defined as Public at the top of the module.)
What's supposed to happen is that whenever a wrong answer is given, FaultArray (a 2D array, 3 elements wide) gets a new line.
On this line will be written
1) the question that was asked
2) the answer that the user gave
3) the correct anser
So that I can present the answers to the wrong questions after the quiz.
Problem is: the second time the sub processes a wrong answer, I get a 'subscript out of range' error.
Am I overlooking something? I'm stomped
quiz v10b.xlsm![]()
Sub CheckAnswerA() If Worksheets("quiz").Range("K3").Value = Answer Then Score = Score + 1 Range("K7").Value = Score Call Again Else: Fault = Fault + 1 ReDim Preserve FaultArray(1 To Fault, 1 To 3) FaultArray(Fault, 1) = Question FaultArray(Fault, 2) = Worksheets("Quiz").Range("K3").Value FaultArray(Fault, 3) = Answer Call Again End If End Sub
Bookmarks