K
KR
I have a userform with a list of source names, a second list box in which to
put selected names, and an add button to move the selected names to the
second listbox.
I need to avoid having the same name added more than once, and although the
code below seems like a good idea to prevent duplicates, I'm getting a type
mismatch. I think I'm mis-referencing the second element in the match
statement, but I'm not sure how to reference the list inside the second
listbox.
Please help? I'm using XL2003
Thanks,
keith
For i = 0 To frmEntry.lstSource.ListCount - 1
If frmEntry.lstSource.Selected(i) = True Then
If IsError(Application.Match(frmEntry.lstSource.List(i),
frmEntry.lstSelected.List, 0)) Then '*** mismatch error
frmEntry.lstSelected.AddItem frmEntry.lstSource.List(i)
End If
End If
Next i
put selected names, and an add button to move the selected names to the
second listbox.
I need to avoid having the same name added more than once, and although the
code below seems like a good idea to prevent duplicates, I'm getting a type
mismatch. I think I'm mis-referencing the second element in the match
statement, but I'm not sure how to reference the list inside the second
listbox.
Please help? I'm using XL2003
Thanks,
keith
For i = 0 To frmEntry.lstSource.ListCount - 1
If frmEntry.lstSource.Selected(i) = True Then
If IsError(Application.Match(frmEntry.lstSource.List(i),
frmEntry.lstSelected.List, 0)) Then '*** mismatch error
frmEntry.lstSelected.AddItem frmEntry.lstSource.List(i)
End If
End If
Next i