PDA

View Full Version : Solved: Duplicate Combobox Entries on Reset



Juicey27
09-14-2010, 10:30 AM
Userform in Excel 2007 - VBA
After filling out userform and clicking submit button, on the next use of the form, the combo boxes on the userform clear out BUT duplicate the names in the list. So, for example I have a combo box that has four names in it, and when I use the userform again, that same combox box has now has eight names in it. The original four plus duplicates of each. There are now 2 sams, 2 mikes, 2 johns and so on . . . . . Funny things is when i click on the X in the topright of the userform, it actually clears and resets the form as it should, with each name only once. I'm thinking there is something wrong with my initialize form code. Here is the code:

Private Sub UserForm_Initialize()
cboCoaches.Value = ""
cboNames.Value = ""
txtComments.Value = ""
cboNames.SetFocus

With cboNames
.AddItem "Mark Petersen"
.AddItem "Emeus Corley"
.AddItem "Joseph Cox"
.AddItem "Joseph Romanini"
.AddItem "Duffy O'Toole"
.AddItem "Clinton Rowland"
End With

With cboCoaches
.AddItem "Mark Petersen"
.AddItem "Emeus Corley"
.AddItem "Salvatore Liotta"
.AddItem "Chris Longo"
End With

End Sub
Can someone please take a look at this? Any help is appreciated. Let me know if I can provide more info, screen shot attached.

Kenneth Hobs
09-14-2010, 02:26 PM
With cboNames
.Clear

Juicey27
09-14-2010, 02:35 PM
Fabulous. Thanks you much.