Hi All,
I am using Excel 2007 and am working on a test grading macro. What I am trying to do is compare the test answers (E2:EQ2) to the student's answers (E10:EQ10) and have the overall score placed in a designated cell (ER10). I have seen a lot of posts regarding comparing two columns and have tried to apply that logic to the rows but I'm not quite getting it right. Unfortunately, the Excel file is on a closed network so I can't post it here (that would make it too easy ). This is what I have so far for the macro:
Sub TestScore ()
Dim i As String
Dim lastrow As String
Dim a As Integer
For a = 5 To 148
If ActiveSheet.Range(lastrow, a).value = ActiveSheet.Range(2, a).value Then
i = i + 1
End If
Next a
ActiveSheet.Range(lastrow, 149).value = i
End Sub
Any help would be greatly appreciated.
Tom
I am using Excel 2007 and am working on a test grading macro. What I am trying to do is compare the test answers (E2:EQ2) to the student's answers (E10:EQ10) and have the overall score placed in a designated cell (ER10). I have seen a lot of posts regarding comparing two columns and have tried to apply that logic to the rows but I'm not quite getting it right. Unfortunately, the Excel file is on a closed network so I can't post it here (that would make it too easy ). This is what I have so far for the macro:
Sub TestScore ()
Dim i As String
Dim lastrow As String
Dim a As Integer
For a = 5 To 148
If ActiveSheet.Range(lastrow, a).value = ActiveSheet.Range(2, a).value Then
i = i + 1
End If
Next a
ActiveSheet.Range(lastrow, 149).value = i
End Sub
Any help would be greatly appreciated.
Tom