ComboBox and Set Focus

  • Thread starter Thread starter Ming Shao
  • Start date Start date
M

Ming Shao

Hi,

Thanks for the help for my SQL question!!!

I have two more questions

(The application is Excel VBA. All controls are in a user form)

1. For ComboBox, how can I prevent users from entering any value other
than those in the listed choices in the ComboBox? User can only select
the value from the list.

2. There are several Text Boxes in my application. Users need to enter
numeric data in these boxes. The function required is if users enter any
character, e.g. 300k, there will be an error message and the focus
should fix in that TextBox (users can't move from this box to other
controls until they enter a valid value).

Thanks

Ming
 
You can set matchrequired property so that they can only
pick from the list.

You could use the keyup event to check the character just
entered to display a msgbox with an error message and
then delete the last character entered. Probabley easier
to check the text when they leave the box (less overhead)
and then set focus back to the control they just left.
 
Back
Top