E
EAB1977
Hi everyone,
I am having some trouble with one of my sub routines. On my Remove
button, when I highlight a item in my list box and click on my remove
button, both items are removed from my list box. I can't see what is
wrong, so if could get another set of eyes to look at it, that would
be great.
Private Sub btnRemove_Click()
Dim i As Integer
On Error GoTo btnRemove_Click_Err
'Remove items that are selected
With lstBox
For i = .ListCount - 1 To 0 Step -1
If .Selected(i) Then
Call .RemoveItem(i)
End If
Next i
End With
btnRemove_Click_Err_Exit:
Exit Sub
btnRemove_Click_Err:
MsgBox Err.Description, , "Error: " & Err.Number
Resume btnRemove_Click_Err_Exit
End Sub
I am having some trouble with one of my sub routines. On my Remove
button, when I highlight a item in my list box and click on my remove
button, both items are removed from my list box. I can't see what is
wrong, so if could get another set of eyes to look at it, that would
be great.
Private Sub btnRemove_Click()
Dim i As Integer
On Error GoTo btnRemove_Click_Err
'Remove items that are selected
With lstBox
For i = .ListCount - 1 To 0 Step -1
If .Selected(i) Then
Call .RemoveItem(i)
End If
Next i
End With
btnRemove_Click_Err_Exit:
Exit Sub
btnRemove_Click_Err:
MsgBox Err.Description, , "Error: " & Err.Number
Resume btnRemove_Click_Err_Exit
End Sub