Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel VBA - Selection changed in combobox limits text box entry

Hi

I have a combo box and a text box on a form.
The combobox has three items "A". "B" and "C"
If the user selects "A" then I want them to only be able to enter alphabetical letters into the text box
If the user selects "B" then I want them to only be able to enter numbers up to 60000 into the text box
If the user selects "C" then I want them to only be able to enter both numbers up to 60000 and alphabetical letters into the text box

What code do I use to achieve this

Thanks in advance

Avatar of SysExpert
SysExpert
Flag of Israel image

I would validation code based on the combobox choice.
Other options are to use 3 diferent  temporary input fields that are validating based on your needs, and simply copy the result from the field actually used to your final field.

I hope this helps !
ASKER CERTIFIED SOLUTION
Avatar of R_Rajesh
R_Rajesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Great answer. thanks very much