Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2013 VBA Find data in table to populate a label

Status
Not open for further replies.

JasonEnsor

Programmer
Sep 14, 2010
193
GB
Hi Guys,

I have a table in Excel 2013, that has 2 columns (Team Lead, Team Name)

I am using the values from Team Lead to populate a combobox
Code:
teamLeads.List = Worksheets("Sheet1").ListObjects(1).ListColumns(1).DataBodyRange.Value

what I am wanting is that once a value is chosen from the combobox it populates a label with the corresponding team name. Is there a better way of doing this that looping through the excel column checking every value? Not sure if there is a way of restricting the search to just looking at the table column then returning an offset value (the next column over)

the layout of my table is

Team Lead | Team Name
Jason | Team 1
Tom | Team 2
Bob | Team 3

So if Jason was picked from the Combobox I would want the label to show Team 1

Any ideas or advice would be appreciated.

Regards

J/

Regards

J.
 
Hi,

What kind of control: Forms, AcyiveX, Data Validation?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Hi Skip,

This the combobox is on a userform. There is no data validation setup for the drop downs

Regards

J.
 
Use the MATCH() function to find the offset in the list and then the INDEX() function to return the corresponding value in that offset row.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top