njmiller31
New Member
- Joined
- Nov 28, 2012
- Messages
- 8
Hello,
I have created a multiplication test for 2nd grader. The goal is for him to fill out the table on the "Test" sheet and then run my macro. The macro would then compare his answers to the those on the (locked) "Answers" sheet. The macro would then display a MsgBox with the number of correct answers as well as highlight the answers he got wrong on the "Test" sheet.
I've been (surprisingly) successful with everything up until it comes time to compare and highlight the incorrect answers. Here's what I have for that part:
Any ideas where I'm going wrong
I have created a multiplication test for 2nd grader. The goal is for him to fill out the table on the "Test" sheet and then run my macro. The macro would then compare his answers to the those on the (locked) "Answers" sheet. The macro would then display a MsgBox with the number of correct answers as well as highlight the answers he got wrong on the "Test" sheet.
I've been (surprisingly) successful with everything up until it comes time to compare and highlight the incorrect answers. Here's what I have for that part:
Code:
[FONT=arial]Sub Correct_Incorrect()[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]Dim correct_answers As Range[/FONT]
[FONT=arial]Dim test_answers As Range[/FONT]
[FONT=arial]Dim cell As Range[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]Set correct_answers = Worksheets("Answers").Range("<wbr>B2:M13")[/FONT]
[FONT=arial]Set test_answers = Worksheets("Test").Range("B2:<wbr>M13")[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]For Each cell In test_answers[/FONT]
[FONT=arial] If cell.Value = correct_answers.Value Then[/FONT]
[FONT=arial] Cells.Interior.ColorIndex = 50[/FONT]
[FONT=arial] Else[/FONT]
[FONT=arial] Cells.Interior.ColorIndex = 3[/FONT]
[FONT=arial] End If[/FONT]
[FONT=arial]Next cell[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]End Sub[/FONT]
Any ideas where I'm going wrong