Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 03-28-2023, 03:00 PM
NoSparks NoSparks is offline Macro Not Tracking Total Score Correctly Windows 10 Macro Not Tracking Total Score Correctly Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

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
        If Mid(btnClicked, 9, 1) = answer Then
            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
        End If
        
        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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Total float not calculating correctly praneetbvb Project 0 04-30-2020 10:17 AM
Macro Not Tracking Total Score Correctly Need to tally check boxes (labeled 1-5) on performance review to get total score based on box value. Learners Permit Word 2 07-16-2018 07:56 PM
Macro Not Tracking Total Score Correctly Macro functioning correctly H28Sailor Excel Programming 2 12-11-2016 03:18 PM
Ad a quiz with different scores for each question and with final score at the end Amadeus PowerPoint 0 09-16-2014 04:24 AM
How to invoke the macro correctly in the workflow smndnm Word VBA 6 07-08-2014 03:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft