Hi experts,
this code was working with some project but when I use it with a new project in version office 2019 will close workbook and recovery again .
as to office 2010 will show error object variable or with block variable not set in this line
For Each x In .Range("B2:B" & .Cells(Rows.Count, "B").End(xlUp).Row).Value
Private Sub UserForm_Initialize()
Dim ws As Worksheet
Dim dar As Object
Dim x
Set dar = CreateObject("System.Collections.ArrayList")
With ws
For Each x In .Range("B2:B" & .Cells(Rows.Count, "B").End(xlUp).Row).Value
If Not dar.Contains(x) Then dar.Add CStr(x)
Next
End With
dar.Sort
Me.ComboBox1.List = dar.Toarray()
End Sub
the code supposes to fill combobox1 without duplicates ID based on column B .
so what's wrong guys ?