The answers to a quiz are entered in Range("C12:C20").
The answer key is listed in Range("E12:E20") = AA, BB, CC, DD, EE, FF, GG, HH, II.
The quiz answers in Range("C12:C20) = WW, BB, CC, DD, WW, FF, GG, HH, II.
(Two wrong answers to test code)
Run the code:
The code says the first WW is correct, then when it advances to the cell with BB it says that WW is incorrect. That seems to be the reaccuring senario on down the list.
Basicly I just get false info back in the MsgBox replies.
Clearly, I am overlooking some fundamental concept in my coding but I'm at the point where I can't see the forest because of the trees!
The sounds are a positive like tone for a correct answer and negative like tone for an incorrect answer. They are not at issue here.
Thanks.
Howard
[pre]
[/pre]
The answer key is listed in Range("E12:E20") = AA, BB, CC, DD, EE, FF, GG, HH, II.
The quiz answers in Range("C12:C20) = WW, BB, CC, DD, WW, FF, GG, HH, II.
(Two wrong answers to test code)
Run the code:
The code says the first WW is correct, then when it advances to the cell with BB it says that WW is incorrect. That seems to be the reaccuring senario on down the list.
Basicly I just get false info back in the MsgBox replies.
Clearly, I am overlooking some fundamental concept in my coding but I'm at the point where I can't see the forest because of the trees!
The sounds are a positive like tone for a correct answer and negative like tone for an incorrect answer. They are not at issue here.
Thanks.
Howard
[pre]
Code:
Option Explicit
Option Compare Text
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub CheckAnswers()
Dim c As Range
For Each c In Range("C12:C20")
If c.Value = c.Offset(0, 2).Value Then sndPlaySound32 "C:WindowsMediaChimes.wav", 0&
MsgBox "Answer " & c & " is correct.", vbOKOnly
c.Offset(1, 0).Select
If c.Value <> c.Offset(0, 2).Value Then sndPlaySound32 "C:WindowsMediawoohoo.wav", 0&
MsgBox "Sorry, answer " & c & " is incorrect "
c.Offset(1, 0).Select
Next
End Sub