View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Selected ListBox item to TextBox

Try this DblClick event code instead of what you posted...

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
UserForm2.TextBox1 = ListBox1.List(ListBox1.ListIndex, 2)
End Sub

--
Rick (MVP - Excel)


"Honnore" <u51305@uwe wrote in message news:94e04f7c72662@uwe...
Hi there dear reader...
Usually I find all responses to my Excel issues in already existing
threads.
Today not. So any help will be more than welcome. The situation is as
follows.


I have one UserForm with one multiple-column ListBox in it.
I would like to add the value of the third column of the selected item of
the
ListBox to a TextBox located in another userform. The below code does not
work :

Private Sub ListBox1_DblClick(ByVal cancel As MSForms.ReturnBoolean)
For i = 0 To UserForm1.ListBox1.ListCount - 1
If UserForm1.ListBox1.Selected(i) = True Then
UserForm1.ListBox1.List(i, 12).AddItem UserForm2.TextBox1.Text
Next i
UserForm2.Show
End Sub

Thank you in advance for your help
Honnore