I am grading tests and have set up Excel to do it. Here's my question....
I have 2 columns: #A has the number of the question/answer #B has either .. "1" if the answer is correct or "0" if the answer is wrong. In another cell I have how many answers are wrong and next to that I would like to list the numbers of the wrong answers seperated by commas.
example:
A B
1. 0
2. 1
3. 1
4. 0
5. 0

3 wrong answers (next cell is where I want to list.... 1,4,5)
Anybody know the code to do that?
Thanks for helping in advance!

hi serendipity, check out this one. don't know if this is what you need :)

Sub get_zero_value()
Dim i, lrow As Integer
Dim str As String

lrow = ActiveSheet.UsedRange.Rows.Count

For i = 1 To lrow
    If Cells(i, 2).Value = 0 Then
       Cells(1, 3).Value = Cells(1, 3).Value & "," & Cells(i, 1).Value
    End If
Next i

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.