View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default display more info for listbox entry

Hi
You need to put some code in the Listbox click event. I'll assume your
RowSource for the listbox is in A1:B3, so you have three rows of 3
columns. In the width property for the listbox I'll assume columns 2
and 3 have 0 width so you can't see them (I THINK you do this with :0:0
in the width property - check the help). Then

Private Sub Listbox1_Click()
Dim i as integer
With Listbox1
for i = 0 to .ListCount - 1
If .Selected(i) then
Userform1.LB1.Text = .List(i,1)
Userform1.LB2.Text = .List(i,2)
End If
Exit for
next i
End With
End Sub

If you double click your ListBox in the VBE you will see this event in
the drop down menu at the top right (if it is not created for you on
the click)
regards
Paul

#DIV/0 wrote:

Hi,
I have a database on a worksheet and a userform to search one column for a
text string that the user puts in a textbox. The listbox shows just the
filtered cells.
I'd like the user to be able to select an item in the listbox and view
further info for that item (ie the values of other cells in the same row).
I'd put them as the caption of a label or some other "untouchable" way.
For example the text search looks in the product decription (column B) and
I'd like the user to see the product code (column A) and warehouse
availability (Column E).

--
David M