Results 1 to 5 of 5

Unique Values in Combobox in Userform

Threaded View

  1. #1
    Registered User
    Join Date
    04-08-2015
    Location
    America
    MS-Off Ver
    Office 2013
    Posts
    29

    Unique Values in Combobox in Userform

    I have a userform for users to enter data, which is then populated into the spreadsheet.
    This spreadsheet is effectively a contacts database.
    In column C there is a company name. As a result of having multiple contact for each company, company names are duplicated when I open the userform with a combobox initialised with:

    Dim iRow As Long
    Dim bNeedMore As Boolean
    Dim sName As String
    
      iRow = 11
      bNeedMore = True
      While bNeedMore = True
        iRow = iRow + 1
        sName = Trim(Sheets("Sheet1").Cells(iRow, "C"))
        If Len(sName) > 0 Then
          CompanyComBox.AddItem sName
          CompanyComBox.List(CompanyComBox.ListCount - 1, 1) = iRow
        Else
          bNeedMore = False
        End If
      Wend
    I would like to somehow alter this code to remove duplicates in column C.

    Any help is appreciated.

    Cheers,

    nKife
    Last edited by nKife; 11-17-2015 at 07:40 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Unique items in combobox on userform
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-16-2015, 09:31 AM
  2. Add only unique values to combobox problem
    By Fredma in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-02-2014, 09:09 AM
  3. [SOLVED] Unique values in a variable Combobox
    By JorisDDS in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-13-2014, 04:33 PM
  4. [SOLVED] Userform combobox to populate RowSource for new values in combobox
    By Stratfordoaks in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-17-2013, 01:18 PM
  5. Userform: Unique Values to ComboBox
    By dinosaur1993 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-21-2013, 03:09 AM
  6. [SOLVED] Changed userform combobox to listbox, unable to get userform to retrieve datasheet values
    By dragonabsurdum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2013, 01:38 PM
  7. fill combobox with unique values.
    By ali84pk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2011, 06:23 AM

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