View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gbpg gbpg is offline
external usenet poster
 
Posts: 58
Default Excel programming errors for copying and pasting

I have been trying to use controls ( I am new) in excel. I want to have lists
that users can select (multiple choices from) push a command button and the
values will be copied and pasted to another list box. I copied code from a
book I bought and named everything as described - but I am getting the
following error:

invalid qualifier

This is the code

Sub Button3_Click()
Dim i As Integer
Dim ListBox1 As Long

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


End Sub