Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Populate userform textboxes from combobox selection

0

Thanks in advance,

What I am trying to do is use a userform combobox to make a selection and populate multiple textboxes within that userform.  The sheet that the values from the combobox are found in Column A.  The values occur more than once.  The values that are needed to populate the text boxes are found in adjacent cells.  For example dog is chosen in the combobox:

             Column A       Column B      Column C

Row 1.  Dog                Lab                Collie

Row 2.  Cat                 yellow            Black

Row 3.  Dog                Shepherd      Rot

textbox1 populates with Lab

Textbox2 populates with collie

Textbox 3 populates with Shephard

Textbox4 populates with Rot

Any help would be great!



Answer
Discuss

Discussion

mmmm ok so you are not very clear about what you want to do. It looks like you have drop-down menus in the worksheet and want to use those to populate a userform? Are you even using a userform? Please give much more specific details, for instance, why wouldn't the cat go into the userform? It's not clear what you are asking...

Here is a userform tutorial on putting data into a userform, but until you explain the issue better, I can't be of much help.
don (rep: 1989) Feb 6, '18 at 10:46 am
Add to Discussion

Answers

0

Your request is pretty much standard fare. Use a multi-column combobox. Load it with the content intended for the textboxes in invisible columns. Then use the Cbx's change event to populate the Tbxs with the content of the hidden columns.

The key to realising this is the arrangement of the data on the sheet and the code which transfers this data into the Cbx when loading the user form. One really needs a workbook with the data source table, the code that opens the user form, the user form itself with the Cbx and Tbxs and whatever code exists for them.

O course, the Cbx must be formatted correctly too. The number of columns must be specified and their visibility in the dropdown. You may prefer to use code for the setup so that you can control it 100%. Make sure that you don't allow the user to enter values not in the list or provide code to instruct the form what to show in th Tbxs in such an event.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login