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
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

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,270
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..
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,437
Messages
5,831,629
Members
430,079
Latest member
lucasabreueng

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top