Dynamic drop down list, how to do?


New Member
Aug 17, 2011
Sheet 1
ColA ColB
1 AnsA
3 AnsR
1 AnsF
1 AnsS
2 AnsD

Sheet 2 - Should have drop down
ColC - should have unique list from Sheet1!ColA. for eg. 1,3,2
ColD - list should be based on selection in ColC. For eg., if I select 1 in ColC, This should list AnsA, AnsF, AnsS

How to do this?


Well-known Member
Sep 24, 2009
If that doesnt work for you....Try below code that gives you a unique list of items from ColA. change accordingly to print in sheet2. now it takes data from colA of activesheet and prints in the activesheet in colmunC.

Sub uniqueList()
Dim uniqueArray() As Variant
Dim count As Integer
Dim notUnique As Boolean

ReDim uniqueArray(0) As Variant
uniqueArray(0) = Range("A1")
count = 0

Dim cl As Range
For Each cl In Range("A2:A" & Range("A" & Rows.count).End(xlUp).Row)
    notUnique = False
    For i = LBound(uniqueArray) To UBound(uniqueArray)
        If (cl.Value = uniqueArray(i)) Then
            notUnique = True
            Exit For
        End If
    Next i
    If notUnique = False Then
        count = count + 1
        ReDim Preserve uniqueArray(count) As Variant
        uniqueArray(UBound(uniqueArray)) = cl.Value
    End If
Next cl

    For i = LBound(uniqueArray) To UBound(uniqueArray)
        Range("C1").Offset(i, 0) = uniqueArray(i)
    Next i
End Sub

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...