I have an excel 2003 workbook that contains and alphabetized list of names in the format Last, First.
I have a combobox in a form that reads the contents of the list of names so i can choose one from the list, no problem with that.
If the name is not on the list (after typing several letters of the first name it goes beyond the alphabetical order so the name is not there) i would like to enter the new name into the combobox, then add it to the list and finaly save the complete list back
to the sheet.
My question is: if I type something that is not in the list the program gives me an error. How can i actually solve that?
Here is the code I'm using to choose from the list:
Private Sub UserForm_initialize()
Dim i As Integer
Dim final As String
i = 1
final = "start"
Do While final <> "FIN"
final = Cells(i + 4, 3)
cb_institution.AddItem final, (i - 1)
i = i + 1
cb_institution.RemoveItem (i - 2)