+ Reply to Thread
Results 1 to 3 of 3

ComboBox populated in 2 ways and need to remove duplicate entries

  1. #1
    Registered User
    Join Date
    08-08-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    ComboBox populated in 2 ways and need to remove duplicate entries

    Hi,

    I am new here and an inexperienced programmer so please be gentle!

    I have a userform comboBox which populates using unique values from a dynamic list in the worksheet and adds some additional items using .Additem. I have uploaded a sample of the workbook. I am currently working on the TypeComboBox in the BasicInformation userform. My problem is that once the .additem entries are selected by the user they end up in the same column which is being read by the combobox when looking for unique entries. Therefore the comboBox lists the entry twice as it is a unique entry in the column but is also added via the .additem. By way of an example I have inputted a sample entry selecting Architecture from the ComboBox. If you now add another record using supply chain vforum.xlsthe command button on the worksheet Architecture appears twice in the combobox in the userform.

    I think there are a couple of options to solve the problem but I don't know how to write the code for either;
    1. Once all of the entries are added (from both the worksheet column and the .additem values) add code which seeks to remove duplicates from the combined list in the comboBox.
    2. Add the items from the worksheet column and then use code which says something like
    if "blah" is not in combobox then .additem "blah"

    I think the second option should be relatively simple but it has got me stumped. Any help will be greatly appreciated!

    Thanks in advance!
    Last edited by jeenius99; 08-08-2012 at 09:50 AM. Reason: Example workbook now attached.

  2. #2
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: ComboBox populated in 2 ways and need to remove duplicate entries

    For your #2 option with AddItem, try this:
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-08-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: ComboBox populated in 2 ways and need to remove duplicate entries

    Perfect, thank you!!!

+ 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