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!

Name ranges with a combo box

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US
How do I apply a Name Range to a combo box?? Thanks

"The reward of one duty done is the power to fulfill another"
J R C L [jester] W N


 
[tt]Here's a better question:
How do I use this code:

=IF(A9="","",VLOOKUP(A9,myRange,2,FALSE))

with a combo box.

I already have a Name Range with cells where I have listed different topics with related fields as follows:

On a table I have:
Toyota
Camry
4Runner
Celica
etc

Nissan
Maxima
Sentra
etc

etc...


When my user type the car type in a specific cell the make of the vehicle appears next to it by using the Vlookup function.

Now I need to use the same function using the combo box and what I'm trying to do is:
When the users selects his\her name from the combo box their INITIALS will populate the combo box and NOT their name


Sorry to be a bit lengthy and Thanks in advance.

[/tt]

"The reward of one duty done is the power to fulfill another"
J R C L [jester] W N


 
On_change event of combobox

Sub combo1_Change()
refTXT = Sheets("Sheet1").DropDowns("combo1").Value
refINIT = Application.VLookup(refTXT, Sheets("Sheet1").Range("A1:c2"), 3, False)
Sheets("Sheet1").DropDowns("combo1").Text = refINIT
End Sub

This works with:
Forms combobox called combo1

table in A1:C2 with 1 Name Initials
2 Name Initials

etc etc
Also, the input range of the combobox should be B1:B2

Obviously your list will be longer but this works. If your combobox is from the controls toolbox, the syntax will be different

HTH
Geoff
 
[tt]What am I doing wrong when I get this error:

Unable to get dropdown property of the worksheet class[/tt]

[hammer]

"The reward of one duty done is the power to fulfill another"
J R C L [jester] W N


 
A: Which dropdown box are you using - Forms or Controls
B: Have you named the box "Combo1" ?
Geoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top