Re: Populating ComboBox with unique values (case sensitivity)
an alternative solution... 
Option Explicit
Private Dic As Object
Private Sub UserForm_Activate()
'Populate ComboBox1
Dim ws As Worksheet, v, i As Long
Dim sKey As String, sItems As String
Set Dic = CreateObject("Scripting.Dictionary")
Set ws = Worksheets("Quartz")
v = ws.Range("B4", ws.Cells(Rows.Count, "B").End(xlUp).Offset(, 1)).Value
Me.ComboBox1.Clear
For i = 1 To UBound(v, 1)
sKey = v(i, 1)
If Len(sKey) Then
sItems = Dic.Item(sKey)
If Len(sItems) Then
If InStr(1, sItems, v(i, 2), 1) = 0 Then
Dic.Item(sKey) = sItems & "|" & v(i, 2)
End If
Else
Dic.Item(sKey) = v(i, 2)
End If
End If
Next
If Dic.Count Then
Me.ComboBox1.List = Dic.keys
End If
End Sub
Private Sub ComboBox1_Change()
'Populate ComboBox2
Dim v, sKey As String
Me.ComboBox2.Clear
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
sKey = ComboBox1.Value
v = Split(Dic.Item(sKey), "|")
Me.ComboBox2.List = v
End Sub
Display More