+ Reply to Thread
Results 1 to 3 of 3

How to het the text in a combobox be something not in the list?

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2010, 2013, 2016, 365
    Posts
    79

    Question How to het the text in a combobox be something not in the list?

    Hi All,

    This should be really simple but I've never been able to figure it out.

    I have comboboxes on a form. I want the text displayed in the combobox before the user clicks it to be the title of that list, rather than an item in the list, e.g. I want the text it displays to be "Select your option" but i don't want that to be an entry in the list.

    I know you can set the text property in VBE so that it defaults to that value but my problem is that, once I programmatically clear the list I want to reset the text to be "Select your option" - but if I try to set the text or value parameters to something that isn't an item on the list it kicks out an error. If I add "Select your option" to the list, it then means the user might accidentally select that item, which I don't want to happen.

    I tried adding a "_DropButtonClick" procedure that deletes the "Select your option" item from the list but if you then don't choose any item, it kicks out an error because the value <> a list item...

    Any thoughts?

    Thanks
    Last edited by AdLoki; 07-23-2013 at 09:32 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to het the text in a combobox be something not in the list?

    Have you set the combobox's MatchRequired property to True?

    If you have that could be the problem.

    Try changing that property to False and checking the value of ListIndex.

    If ListIndex is -1 then nothing has been selected.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    06-28-2011
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2010, 2013, 2016, 365
    Posts
    79

    Re: How to het the text in a combobox be something not in the list?

    Oh God, thank you so much! This has bugged me for years - I knew it was simple!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Add combobox to a Word doc and populate the combobox with list of about 65 items
    By excelaron in forum Word Programming / VBA / Macros
    Replies: 6
    Last Post: 06-21-2012, 01:59 PM
  2. Filling Combobox Based on another combobox.text value.
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 02-18-2012, 01:20 AM
  3. Add to combobox list by entering new text in textbox
    By processchip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2012, 09:13 AM
  4. Populating the list in a combobox based off the value chosen in another combobox
    By Mervil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2010, 11:50 AM
  5. [SOLVED] ComboBox list reliant on the entry from a different ComboBox
    By ndm berry in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-04-2005, 12:05 PM

Tags for this Thread

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