ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   LIstbox Question (https://www.excelbanter.com/excel-programming/300171-listbox-question.html)

Rich Cooper

LIstbox Question
 
I am very knew to listboxs, i am trying to understand them. I have a
listbox reading a list of names from a range. On this sheet i have a
listbox and two textboxes. I am trying to get it so when you select an item
in the list box the first text box show the name of the person you selected
in the listbox. The second textbox will show the value of that item in the
listbox. For example if you selected the first name rich. The first
textbook would show rich and the other one would show 0. How do i do this i
am having trouble.



Dick Kusleika[_3_]

LIstbox Question
 
Rich

Use the Change event of the listbox.

Private Sub ListBox1_Change()

Me.TextBox1.Text = Me.ListBox1.Value
Me.TextBox2.Text = Me.ListBox1.ListIndex

End Sub

Right click on the sheet's tab and choose View Code. Use the drop down
boxes at the top and choose ListBox1 and Change to get the Sub and End Sub
statements. Change the names in the above code to the actual names of your
controls.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Rich Cooper" wrote in message
...
I am very knew to listboxs, i am trying to understand them. I have a
listbox reading a list of names from a range. On this sheet i have a
listbox and two textboxes. I am trying to get it so when you select an

item
in the list box the first text box show the name of the person you

selected
in the listbox. The second textbox will show the value of that item in

the
listbox. For example if you selected the first name rich. The first
textbook would show rich and the other one would show 0. How do i do this

i
am having trouble.






All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com