Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA for Excel, How do I Limit Choices in the ComboBox,

Posted on 2011-09-11
4
Medium Priority
?
361 Views
Last Modified: 2012-06-27
I am trying to limit my UserForm1.comboBox1  to predefined choices and not letting the user to write inside it without actually greying it out.....

Any idea as to how to do this either within the VBA Properties window or a Macro ?

Thanks in advance....
0
Comment
Question by:New_Alex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
AgeOfEmpires earned 2000 total points
ID: 36519286
If you set it's Style property to frmStyleDropDownList, the user can only select the items you've predefined.  The default Style property for the combobox is frmStyleDropDownCombo, which let's the user choose from your predefined choices, or enter a value of their own.
0
 
LVL 35

Expert Comment

by:Norie
ID: 36519299
Why not check if what they've entered is one of the choices?

Assuming the choices are in the comboboxes dropdown you can do that by checking the ListIndex.

If they've entered something that's not on the list it will be -1 and if it is on the list it will return the index of the item in the list.
0
 
LVL 1

Author Closing Comment

by:New_Alex
ID: 36536207
Thank you SIR !
0
 
LVL 4

Expert Comment

by:AgeOfEmpires
ID: 36536300
Glad I could assist.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question