Listbox text to Textbox (Solved)

buffyiscool

New Member
Joined
Jul 23, 2005
Messages
47
I have a userform containing a multicolumn listbox (ListBox1) and textbox (txtSelectedJobNumber).

When a user clicks on a line in the listbox I want to automatically copy the text in the 3rd column of the selected line to the textbox.

If anyone could provide code which would allow me to do this I would be grateful

Thanks

Colin
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Re: Listbox text to Textbox

try
Code:
Private Sub ListBox1_Click()
With ListBox1
     If .ListIndex > -1 Then
          txtSelectedJobNumber.Value = .List(.ListIndex, 2)
     End If
End With
End Sub
 
Upvote 0
re: Listbox to textbox

thanks jindon

The code you provided works exactly as I wanted.

Thank you for your help and quick response to my post.

Regards
Colin
 
Upvote 0

Forum statistics

Threads
1,213,520
Messages
6,114,099
Members
448,548
Latest member
harryls

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
Back
Top