View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
gbpg gbpg is offline
external usenet poster
 
Posts: 58
Default command button that copies and pastes from one list box to another

I inserted the below code to accomplish the below. Why do I get an error for
the i ?

Private Sub CommandButton1_Click()
If ListBox2.ListIndex = -1 Then Exit Sub
If Not cbDuplicates Then
'See if item already existss
For i = 0 To ListBox2.ListCount - 1
If ListBox2.Value = ListBox3.List(i) Then
Beep
Exit Sub
End If
Next i
End If
ListBox3.AddItem ListBox2.Value

End Sub