View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Steve Steve is offline
external usenet poster
 
Posts: 1,814
Default Combobox Error Handling

Dave,

How do I check if it is on the list before I put it in?

"Dave Peterson" wrote:

Why not check to see if the value is on the list before you plop it into the
combobox?



steve wrote:

I have some ComboBoxes on a form. I set MatchRequired = True. If I fill
these boxes with data from a worksheet (through VBA), it will let me use
items that are not found in the required list.
In other words, the required match is not checked until the user enters then
exits the combobox. How do I check that the MatchRequired has been met if
the user is not going to go in, then out, of every combobox?
Example:

the combobox is named ComboBoxColors
the validated list contains these items:
"Blue"
"Green"
"Red"

If I use VBA and say, ComboBoxColors.Value = "Pink" (value from a
worksheet), it will set the value = "Pink".
If I then enter the combobox, then leave it, I will get an error that this
is not a legal entry. How can I trap this error at the time I copy the value
from the worksheet?


--

Dave Peterson