+ Reply to Thread
Results 1 to 5 of 5

combobox limit to list

  1. #1
    Registered User
    Join Date
    03-13-2005
    Posts
    14

    combobox limit to list

    I'd like to limit limit the choices in an Excel combobox to the two items in the list.

    I can specify exact match, but users can still enter text and get an error. What I'd like would be the equivalent to the limit to list proprty in Access.

    I'll settle for some sort of error handler. I think it was error 380. When I try to put an error handler on the before or after update property nothing happes.

    I notice that the error message is labeled form so maybe it is a form error, but, I don't see a form error event.

    Thanks for any help

  2. #2
    Registered User
    Join Date
    07-25-2005
    Posts
    62
    Go to the properties of your combobox (right click and click "properties") and change the "Style" to "2 - fmStyleDropDownList"

  3. #3
    Tom Ogilvy
    Guest

    Re: combobox limit to list

    Combobox.Style = fmStyleDropDownList

    from help on the style property for fmStyleDropDownList (2)

    The ComboBox behaves as a list box. The user must choose a value from the
    list.

    --
    Regards,
    Tom Ogilvy


    "tmort" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I'd like to limit limit the choices in an Excel combobox to the two
    > items in the list.
    >
    > I can specify exact match, but users can still enter text and get an
    > error. What I'd like would be the equivalent to the limit to list
    > proprty in Access.
    >
    > I'll settle for some sort of error handler. I think it was error 380.
    > When I try to put an error handler on the before or after update
    > property nothing happes.
    >
    > I notice that the error message is labeled form so maybe it is a form
    > error, but, I don't see a form error event.
    >
    > Thanks for any help
    >
    >
    > --
    > tmort
    > ------------------------------------------------------------------------
    > tmort's Profile:

    http://www.excelforum.com/member.php...o&userid=21053
    > View this thread: http://www.excelforum.com/showthread...hreadid=389992
    >




  4. #4
    STEVE BELL
    Guest

    Re: combobox limit to list

    You could add a check in your code that looks at the
    combobox.value and checks to see if it is in the list.

    If combobox1.value = 1 or combobox1.value = 2 then
    ' continue code
    Else Msgbox "You did not make an acceptable selection. Please try again"
    ' code to restart the procedure
    End If

    --
    steveB

    Remove "AYN" from email to respond
    "tmort" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I'd like to limit limit the choices in an Excel combobox to the two
    > items in the list.
    >
    > I can specify exact match, but users can still enter text and get an
    > error. What I'd like would be the equivalent to the limit to list
    > proprty in Access.
    >
    > I'll settle for some sort of error handler. I think it was error 380.
    > When I try to put an error handler on the before or after update
    > property nothing happes.
    >
    > I notice that the error message is labeled form so maybe it is a form
    > error, but, I don't see a form error event.
    >
    > Thanks for any help
    >
    >
    > --
    > tmort
    > ------------------------------------------------------------------------
    > tmort's Profile:
    > http://www.excelforum.com/member.php...o&userid=21053
    > View this thread: http://www.excelforum.com/showthread...hreadid=389992
    >




  5. #5
    Registered User
    Join Date
    03-13-2005
    Posts
    14
    Thanks,

    Stype 2 works fine for my purposes but I'm glad to learn of the other check value method too

+ 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