Having data populate text boxes based on Combobox Value

  • Thread starter Todd Huttenstine
  • Start date
T

Todd Huttenstine

On Sheet2 I have a table comprised of 3 columns. the
table is located in Range A3:C52.

In Range A3:A52, there are Employee ID numbers.
In Range B3:B52, there are Names.
In Range C3:C52, there are Email Addresses.

On a userform(Userform3), I have a ComboBox(ComboBox1).
ComboBox1 can contain the employee ID, Name, or Email
Address. UserForm3 also contains 3 text boxes. Textbox1,
TextBox2, and TextBox3.

TextBox1 is where the Employee ID will be, TextBox2 is
where the Name will be, and TextBox3 is where the Email
Address will be. The values in these 3 textBoxes will
depend on what the value of ComboBox1 is.

I need for these 3 textboxes to look at the value in
ComboBox1 and then look at the table on Sheet2 Range
A3:C52 and pull back the corresponding data. I need for
this data to be put in the 3 textboxes. For instance, if
ComboBox1 contains the value "Todd Huttenstine", I need
for TextBox1, TextBox2, and TextBox3 to display the
corresponding data. Lets say the value "Todd Huttenstine"
is located in cell A14 in the Table (which is located in
Range A3:C52). Because the Value Todd Huttenstine is
found within this range, the textboxes populate with the
corresponding value. That is Textbox1 populates with the
A column value(Cell A14 value), Textbox2 populates with
the B column value(Cell B14 value), and Textbox3 populates
with the C column value(Cell C14 value).

Regardless of if Employee ID number, Name, or Email
Address is in ComboBox1, I need the textboxes to auto-
populate with the corresponding values in the table on
sheet2.


I hope this is not confusing. Thanks in advance.


Todd Huttenstine
 
T

Tom Ogilvy

If this is the same userform as in your option button post, you have left
out any information on how it could be determined which column the combobox
is displaying. Also, you have not talked about your data - where is it
possible blanks would be found - are there blanks within the populated
cells - would there be a ID, name and no email, a name and email, but no id,
or are all blanks at the end of the column and if so, then why specify row
53 as the end.

The easiest way to do this would be to populate the combobox with all three
columns and get your data from there. Even if you only want to display one
set of data, you could control this with the columnwidth.
Alternately, you could make the combobox have two columns and place the row
number in the second column and hide that column.

Give it a whirl, then post your code if you have a question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top