combobox validation

llan_man

New Member
Joined
Nov 6, 2005
Messages
45
Hi

I have a combox on a userform which is linked to a range of cells. Depending on the value they pick, there is some code that does a vlookup on this value. However, I want to be able to restrict the user to only pick one of the items in the combo list. What I'm finding is that if I key in anything else into the combox, the vlookup fails (as you'd expect).

Any ideas?

Thanks

Harv
 

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Harv

Try changing the combobox matchrequired property to true and the matchentry to fmmatchentrycomplete.

It will allow you to enter other things, but it won't let you leave the box with a nonmatching entry.

HTH

Tony
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,222
llan_man said:
However, I want to be able to restrict the user to only pick one of the items in the combo list.
In the ComboBox's properties window, find the "Style" property, and set it to "2 - fmStyleDropDownList". This will disable people from entering anything in the combobox field, and they will need to select an item from the drop-down method if they want to change the combobox value..
 

Watch MrExcel Video

Forum statistics

Threads
1,118,796
Messages
5,574,359
Members
412,588
Latest member
FabrizioMaurizio
Top