+ Reply to Thread
Results 1 to 3 of 3

Combo Box mandatory selection

  1. #1
    Registered User
    Join Date
    03-20-2006
    Location
    SE England
    Posts
    20

    Combo Box mandatory selection

    Hi,

    I have a Combo Box (added through the Control Toolbox) that I want to be mandatory, i.e. it must always contain one of the values referenced in the ListFillRange. Currently I can select one of the values, but I can then overtype it with something else not in the list, or remove it completely.

    What is the best way to achieve this? I can do it easily using a Combo Box from the Forms toolbar but I want to do some additional processing on selection of a valid entry so I really need the Combo_Change subroutine.

    To give a better idea of the overall picture, imagine a spreadsheet that has the Combo Box with values "Price List A" and "Price List B". According to this selection, a named range will be amended using:
    Please Login or Register  to view this content.
    All subsequent lookup functions in the sheets can then use this named range to look up the correct values.

    What I want to avoid is the user typing in a random value or a blank that the above code can't handle (ignoring for the moment the use of a catch-all Else at the end)

    Thanks in advance,
    Vindaloo

  2. #2
    Tom Ogilvy
    Guest

    RE: Combo Box mandatory selection

    change properties

    matchentry FmMatchEntryNone
    style fmStyleDropDownList

    then the user must select from the list.

    --
    Regards,
    Tom Ogilvy


    "Vindaloo" wrote:

    >
    > Hi,
    >
    > I have a Combo Box (added through the Control Toolbox) that I want to
    > be mandatory, i.e. it must always contain one of the values referenced
    > in the ListFillRange. Currently I can select one of the values, but I
    > can then overtype it with something else not in the list, or remove it
    > completely.
    >
    > What is the best way to achieve this? I can do it easily using a Combo
    > Box from the Forms toolbar but I want to do some additional processing
    > on selection of a valid entry so I really need the Combo_Change
    > subroutine.
    >
    > To give a better idea of the overall picture, imagine a spreadsheet
    > that has the Combo Box with values "Price List A" and "Price List B".
    > According to this selection, a named range will be amended using:
    >
    > Code:
    > --------------------
    > If Combo.Value = "A" Then
    > ActiveWorkbook.Names("pricelist").RefersTo = "=prices!$A$1:$B$10"
    > ElseIf Combo.Value = "B" Then
    > ActiveWorkbook.Names("pricelist").RefersTo = "=prices!$D$1:$E$10"
    > End If
    >
    > --------------------
    >
    > All subsequent lookup functions in the sheets can then use this named
    > range to look up the correct values.
    >
    > What I want to avoid is the user typing in a random value or a blank
    > that the above code can't handle (ignoring for the moment the use of a
    > catch-all Else at the end)
    >
    > Thanks in advance,
    > Vindaloo
    >
    >
    > --
    > Vindaloo
    > ------------------------------------------------------------------------
    > Vindaloo's Profile: http://www.excelforum.com/member.php...o&userid=32634
    > View this thread: http://www.excelforum.com/showthread...hreadid=524461
    >
    >


  3. #3
    Registered User
    Join Date
    03-20-2006
    Location
    SE England
    Posts
    20
    Thanks very much Tom. Next time I'll have a proper look through the properties!

    Regards,
    Vindaloo

+ 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