Listbox values to populate textboxes?

PATSYS

Well-known Member
Joined
Mar 12, 2006
Messages
1,749
Hi all,

I have a 3-column listbox in my useform. The multiselect is set to SINGLE.

I also have 3 textboxes in the same userform.

Is there a way that when user click an item in the listbox, that the value in the 1st column populates textbox1, 2nd column to textbox2 and the 3rd column to textbox3?

Thanks
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Bill Rockenbach

Well-known Member
Joined
May 4, 2009
Messages
1,412
Private Sub ListBox1_Click()
TextBox1 = ListBox1.Column(0)
TextBox2 = ListBox1.Column(1)
TextBox3 = ListBox1.Column(2)
End Sub
 

PATSYS

Well-known Member
Joined
Mar 12, 2006
Messages
1,749
Hey Bill,

Thanks a lot.

I sort of figured out a way to deal with it:

Code:
With Listbox1
TextBox1.Text = .List(.ListIndex, 0)
TextBox2.Text = .List(.ListIndex, 1)
TextBox3.Text = .List(.ListIndex, 2)
End with

I just checked this thread now and your suggestion is more efficient and hence I will adopt.

Cheers.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,320
Messages
5,600,940
Members
414,417
Latest member
Nobu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top