Solved

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

Posted on 2011-09-11
4
350 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 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 34

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
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.

691 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