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
Solved

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

Posted on 2011-09-11
4
344 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
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
AgeOfEmpires earned 500 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 33

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

840 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