Consulting

Results 1 to 3 of 3

Thread: Solved: Duplicate Combobox Entries on Reset

  1. #1
    VBAX Regular
    Joined
    Sep 2010
    Posts
    23
    Location

    Solved: Duplicate Combobox Entries on Reset

    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:

    [vba]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
    [/vba] Can someone please take a look at this? Any help is appreciated. Let me know if I can provide more info, screen shot attached.
    Last edited by Aussiebear; 09-14-2010 at 05:00 PM. Reason: Added vba tags to code

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]
    With cboNames
    .Clear[/VBA]

  3. #3
    VBAX Regular
    Joined
    Sep 2010
    Posts
    23
    Location
    Fabulous. Thanks you much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •