+ Reply to Thread
Results 1 to 9 of 9

Block users from typing in a combo box

  1. #1
    Registered User
    Join Date
    10-19-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Block users from typing in a combo box

    Hi all.

    I have an issue with a user form I have created. When users open the form there are certain options (ie location) which are a combo box and I only want users to be able to select one of the drop down options. Sadly they can also type in the combo box. How do I block users from typing in a combo box in a user form so that they are forced into selecting one of the drop down options.

    This issue is similar to the following link which was unresolved.

    http://www.excelforum.com/excel-prog...combo-box.html

    Many thanks,

    Alan
    Last edited by bigpee; 12-23-2009 at 11:03 AM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Block users from typing in a combo box

    Use a list box control in place of the combo box.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Block users from typing in a combo box

    Method 1:


    In combo box proproites .. under behaviour you have matchrequire option .. make it true


    method 2: VBA


    try this or code similar tothis


    Please Login or Register  to view this content.
    Last edited by Shijesh Kumar; 12-23-2009 at 10:42 AM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,102

    Re: Block users from typing in a combo box

    Change the Style property to fmStyleDropDownList

    or with code
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Block users from typing in a combo box

    While the code Shijesh Kumar provided is a viable solution, if you only want to permit user's to select from a specific list and never enter a new item, then use the appropriate control - a list box.

    A combo box is intended to allow selections from a list but also permit entry of new items not in the list.

  6. #6
    Registered User
    Join Date
    10-19-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Block users from typing in a combo box

    Thank you to all the replies. Having tried out the top two both work perfectly. I have opted for the code option put forward by Shijesh Kumar since a list box does not fit in so well with the design of my form. Thanks again for all the replies. Hopefully my spreadsheet is now user proof .

  7. #7
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Block users from typing in a combo box

    Glad you found the solution you needed.

    Please mark you thread as solved by going to the top of the page and clicking Thread Tools, then choosing Go Advanced.

    Don't forget to add to the reputation of all who contributed a helpful response. See my signature for how to do this.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,102

    Re: Block users from typing in a combo box

    Why code rather than using the built-in property designed specifically for just this task

  9. #9
    Registered User
    Join Date
    10-19-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Block users from typing in a combo box

    Quote Originally Posted by Andy Pope View Post
    Why code rather than using the built-in property designed specifically for just this task
    Easy answer to this one - I read your post after I had made the code changes. The way you mention above also works a treat and I have now used this method to lock down my user responses. All solutions worked perfectly though .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1