Textbox to display Listbox 2nd column value

  • Thread starter Thread starter Corey
  • Start date Start date
C

Corey

The following is a segment of code i use to populate a Listbox.
I now need to gain the value that when the Listbox3 value is selected(not
multiselect) and place it into Textbox4

Hoiw can i achieve this?
I cannot seem to get the correct syntax for the 2nd column.
If i use Textbox4.value=Listbox3.value, i get the Column 1 value not the
Column 2 Value
********************************************************
ListBox3.AddItem .Cells(myrow, 4).Offset(, i).Value
ListBox3.List(ListBox3.ListCount - 1, 1) = .Cells(myrow, 1).Value
********************************************************

I am sure it is something like:
Textbox4.value=Listbox3(ColumnCount,1).value


Corey....
 
Hello Corey,

MsgBox ListBox1.List(ListBox1.ListIndex, 1)

(Note that first column is zero)
 
Hi again corey,

What you have done will work but not the standard method. If you put that
code into a listbox click event then you get recursive calls on the event and
would need to disable events.

For interest the following simplified code will also return the 2nd column
value.

MsgBox ListBox1.Column(1)
 
Back
Top