Results 1 to 5 of 5

fill combobox with unique values.

Threaded View

  1. #1
    Registered User
    Join Date
    10-21-2009
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    59

    fill combobox with unique values.

    Dear Experts,

    I have below code to fill combobox with unique values. This code works only if data is in same sheet of combobox. My data is in sheet1 and combobox is in sheet2. Can some one please modify this code as per my situation.

    In addition please write some descriptions also, to understand this code for me.

    Thanks in advance

    Private Sub Worksheet_Activate()
    Dim r As Range
    With CreateObject("Scripting.Dictionary")
        .CompareMode = vbTextcompare
        For Each r In Range("a1",Range("a" & Rows.Count).End(xlUp))
            If Not IsEmpty(r) And Not .exists(r.Value) Then .add r.Value, Nothing
        Next
        Me.ComboBox1.List = .keys
    End With
    End Sub
    Last edited by ali84pk; 01-29-2011 at 10:51 AM.

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