Hello,
I have a userform with some comboboxes and commendbuttons, one of the comboboxes named "cmb_Name"
In Sub UserForm_Initialize, I have below peace of code to show the suppliers names in the combobox
And in the userform, there is a commend button to add new supplier named "cmdNewSupplier"
Everything works fine for now, but I need the combobox to be updated and get the new supplier name and show him in the list
I've tried to put the same code above at the end of the Sub cmdNewSupplier_Click
It shows the previous list and the new list, so all the previous names now appears two times and at the end appears the new name
Is there any way to fix this code or any way to update the cobmobox without duplicates?
I have a userform with some comboboxes and commendbuttons, one of the comboboxes named "cmb_Name"
In Sub UserForm_Initialize, I have below peace of code to show the suppliers names in the combobox
Code:
Dim rngName As Range
Dim ws As Worksheet
Set ws = Sheet8
For Each rngName In ws.Range("Suppliers_Name")
Me.cmb_Name.AddItem rngName.Value
Next rngName
And in the userform, there is a commend button to add new supplier named "cmdNewSupplier"
Everything works fine for now, but I need the combobox to be updated and get the new supplier name and show him in the list
I've tried to put the same code above at the end of the Sub cmdNewSupplier_Click
It shows the previous list and the new list, so all the previous names now appears two times and at the end appears the new name
Is there any way to fix this code or any way to update the cobmobox without duplicates?