View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Excel programming errors for copying and pasting

This can't be right:
Dim ListBox1 As Long

Take it out and take it from there.

RBS

"gbpg" wrote in message
...
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