hello can someone help me with the code how to remove duplicates from dropdown list combobox? i need the additional code for preventing the duplicates from the dropdown list. because this code lists the whole data without removing the duplicates. i attach the example file below
Private Sub ComboBox1_Change()
Dim i As Long
With Me.ComboBox1
If Not IsArrow Then .List = Range("AccountsList").Value
If .ListIndex = -1 And Len(.Text) Then
For i = .ListCount - 1 To 0 Step -1
If InStr(1, .List(i), .Text, 1) = 0 Then .RemoveItem i
Next i
.DropDown
End If
End With
End Sub
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
IsArrow = KeyCode = vbKeyUp Or KeyCode = vbKeyDown
If KeyCode = vbKeyReturn Then Me.ComboBox1.List = Range("AccountsList").Value
End Sub