try
Code:
Private Sub cmdSubmit_Click()
Dim lRow As Integer
'Check if user click an option
If cmdA.BackColor = &HFF00& Or cmdB.BackColor = &HFF00& Or _
cmdC.BackColor = &HFF00& Or cmdD.BackColor = &HFF00& Then
'Move to the next question
questionNo = questionNo + 1
Label1.Caption = "Question " & questionNo & " of 10"
If cmdSubmit.Caption = "Submit" Then
lRow = rSH.Range("A" & Rows.Count).End(xlUp).Row + 1
rSH.Range("C" & lRow).Value = rSH.Range("C" & lRow).Value + 1
'rSH.Range("Y1").Value = frm_score.lblScore
txtSampleCode.Text = rSH.Range("C" & lRow).Value
Call get_quiz
ElseIf cmdSubmit.Caption = "End Exam" Then
'Save the quiz result to record sheet
lRow = rSH.Range("A" & Rows.Count).End(xlUp).Row + 1
rSH.Range("A" & lRow).Value = username
rSH.Range("B" & lRow).Value = Now
frm_score.lblName = username
frm_score.lblScore = rSH.Range("C" & lRow).Value + 1
frm_score.Show
Unload Me
End If
Else
MsgBox "Please select an answer.", vbExclamation, mTitle
End If
End Sub