I am using an Active-X listbox on my worksheet and trying to add items but having a problem trying to insert the last item. I'm getting a run-time error. Here is what part of the code looks like:
The error occurs at the last ListBox2.List(i, 10) = ... line. Can anyone help me with this error?
Code:
For r = 3 To rowCount
If Sheets("Sheet2").Range("B" & r).Value = ComboBox1.Value Then
ListBox2.AddItem Sheets("Sheet2").Range("B" & r).Value
ListBox2.List(i, 0) = Sheets("Sheet2").Range("B" & r).Value
ListBox2.List(i, 1) = Sheets("Sheet2").Range("C" & r).Value
ListBox2.List(i, 2) = Sheets("Sheet2").Range("E" & r).Value
ListBox2.List(i, 3) = Sheets("Sheet2").Range("F" & r).Value
ListBox2.List(i, 4) = Sheets("Sheet2").Range("G" & r).Value
ListBox2.List(i, 5) = Sheets("Sheet2").Range("H" & r).Value
ListBox2.List(i, 6) = Sheets("Sheet2").Range("J" & r).Value
ListBox2.List(i, 7) = Sheets("Sheet2").Range("K" & r).Value
ListBox2.List(i, 8) = Sheets("Sheet2").Range("L" & r).Value
ListBox2.List(i, 9) = ComboBox2.Value
ListBox2.List(i, 10) = ComboBox4.Value
i = i + 1
End If
Next
The error occurs at the last ListBox2.List(i, 10) = ... line. Can anyone help me with this error?