Upon selecting a category from a combobox a listbox then updates with only records related to the combobox selection. However the list is producing duplicates and I was wondering how I prevent this from happening.
Private Sub ProdComp_Change()
Dim RowMax As Integer
Dim ws As Worksheet
Dim countexit As Integer
Dim cellcombo2 As String
Dim i As Integer
Set ws = ThisWorkbook.Sheets("products")
RowMax = ws.Cells(Rows.Count, "B").End(xlUp).Row
Me.LBType.Clear
With LBType
For i = 2 To RowMax
If ws.Cells(i, "B").Value = ProdComp.Text Then
.AddItem ws.Cells(i, "c").Value
Else
End If
Next i
End With
End Sub
