Can someone please tell me how to add a code to exclude duplicate values inside the combobox? I already exclude some lines that have certain values in a colomn (for example when the work is already done) If it is not possible to do in in 1 code, it is also ok to remove the duplicates after the combobox list is made. But for this I also cannot figure out how to manage.
Here is the code for my combobox listing. It is placed inside the Userform1_initialize section.
Dim LastRow As Long Dim aCell As Range Set ws = Sheets("Requests") With ws LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row For Each aCell In .Range("B3:B" & LastRow) 'dicard rows in dropdown for ease of use If aCell.Value "" And aCell.Offset(0, 25).Value = "" And aCell.Offset(0, 22).Value "on hold" And aCell.Offset(0, 22).Value "cancelled" Then Me.ComboBox2.AddItem aCell.Value End If Next End With
Value = ""
... Why that? You firstly must exclude the cells in B:B being empty and only after that to fill the combo with ones respecting your conditions... – FaneDuru