Listbox Problem

M

Martin Parker

I have a listbox which is populated with data from a worksheet (column count
= 5)

As the 6th column is a descriptive text field, I would like to hold the data
of the 6th column in another listbox on the same userform.

When the user clicks on the rows in the first listbox, I would like the 6th
column text field to show in the 2nd listbox.

Can anyone help me understand how I can make this happen.

Thanks.
 
P

p45cal

Some clarification needed. When you sayWhen the user clicks on the rows in the first listbox, I would like th
6th column text field to show in the 2nd listbox

do you want:




- For repeated clicks on a row in th 1st listbox to keep adding th
same information to the second listbox ending up with similar rows i
the second listbox?
- Will you instead want to allow multiple selections in the firs
list box and only display what's selected in the first list box in th
second listbox?
- Add only once to the second listbox any row clicked in the firs
listbox?
- Show only one row in the second listbox, that being the las
clicked row in the first listbox?
 
M

Martin Parker

Thanks for your quick reply, I would like to show only one row in the second
listbox, that being the last clicked row in the first listbox.

Cheers
 
P

p45cal

VBA Code:
--------------------


Private Sub ListBox1_Click()
ListBox2.Clear
ListBox2.AddItem Range(ListBox1.RowSource).Offset(ListBox1.ListIndex, 5).Cells(1)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top