#1
|
|||
|
|||
Populate TextBox from ListBox
Hi,
I would like to know how could I populate multiple textboxes when an item on the listbox has been clicked? See attched image. also how could I edit the data by just clicking on the item on the listbox? Thank you |
#2
|
|||
|
|||
Short answer.... use the list boxes Click event.
Where is the data to be loaded into the text boxes in relation to what shows in the list box ? A sample Excel file would be more beneficial than a picture. |
#3
|
|||
|
|||
Here is the sample file.
|
#4
|
|||
|
|||
Code:
Private Sub ListBox1_Click() Me.TextBox1.Value = Application.WorksheetFunction.VLookup(ListBox1.Value, Range("B2:E3"), 3, False) End Sub |
#5
|
|||
|
|||
how do I show all the details about that product on all the textboxes?
|
#6
|
|||
|
|||
The suggestion is one way to populate a textbox based on the listbox selection.
Do the same for each textbox. Your example file is nothing like your picture. Is it reasonable to presume it's a VBA user form ? |
#7
|
||||
|
||||
If you load all the data into the listbox initially (you can hide any columns you don't want displayed), then you can simply access the List property of the listbox directly to assign any column to another control, rather than having to access the worksheet again.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Populate listbox | eduzs | Word VBA | 4 | 07-18-2017 05:28 PM |
This is a Userform LIstbox queston: A variable does not set to the value of a listbox | CatMan | Excel Programming | 14 | 08-18-2014 08:14 PM |
This is a Userform LIstbox queston: A variable does not set to the value of a listbox | CatMan | Excel | 1 | 08-08-2014 09:41 AM |
how to populate textbox based on combobox selection in word | IvanGeorgiev | Word | 1 | 02-21-2013 07:32 PM |
how to populate textbox based on combobox selection in word | IvanGeorgiev | Word VBA | 1 | 02-21-2013 07:28 PM |