View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Cannot dropitem from multiselect listbox

How did you populate those listboxes?

If you used the .rowsource, try looping through the range and populating one at
a time or plop the values in the range into listbox:

Private Sub UserForm_Initialize()

Dim iCtr As Long

With Me.ListBox1
.ListFillRange = Worksheets("sheet1") _
.Range("a1:a10").Address(external:=True)
End With

With Me.ListBox2
.ListFillRange = Worksheets("sheet1") _
.Range("b1:b10").Address(external:=True)
End With

Me.ListBox1.MultiSelect = fmMultiSelectMulti
Me.ListBox2.MultiSelect = fmMultiSelectMulti

End Sub

Edward Glover wrote:

The listboxes and cmd button objects are on a user form. I'm getting
run-time errors on the lines that contain clear and removeitem methods.
The msgbox error is Run-time error '-2147467259 (80004005)': Unspecified
error.

For iCtr = Me.ListBox2.ListCount - 1 To 0 Step -1
If Me.ListBox2.Selected(iCtr) = True Then
Me.ListBox2.RemoveItem iCtr
End If
Next iCtr

and

Me.ListBox1.Clear

thx. for your time.

Edward

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson