Userform ComboBox drop down list keeps duplicating the list

nathanr

New member
Joined
Aug 16, 2016
Messages
19
Reaction score
0
Points
0
i have a userform with 3 drop down selection lists. everytime i click the arrow to list the dropdown it duplicates whats in the list over and over and over until i close the userform and re open it. is there some simple code that i can add to the userform to stop it from duplicating the lists.

attached is my file.
 

Attachments

  • (Digital Offline).xlsm
    57.5 KB · Views: 48
Hello nathanr
Instead of adding items in DropButtonClick event, it is better to fill combobox on UserForm_Initialize
So >> Instead of those lines
Code:
Private Sub cboPassFail_DropButtonClick()
    Me.cboPassFail.AddItem "PASS"
    Me.cboPassFail.AddItem "FAIL"
End Sub


Private Sub cboOperator_DropButtonClick()
    Me.cboOperator.AddItem "Willson"
    Me.cboOperator.AddItem "Jerry"
    Me.cboOperator.AddItem "Billy"
    Me.cboOperator.AddItem "Adam"
    Me.cboOperator.AddItem "John"
End Sub


Private Sub cboQC_DropButtonClick()
    Me.cboQC.AddItem "SUPPLIER"
End Sub

You can fill the three comboboxes in UserForm_Initialize
Code:
Private Sub UserForm_Initialize()
    Me.cboPassFail.AddItem "PASS"
    Me.cboPassFail.AddItem "FAIL"
    '----------------------------
    Me.cboOperator.AddItem "Willson"
    Me.cboOperator.AddItem "Jerry"
    Me.cboOperator.AddItem "Billy"
    Me.cboOperator.AddItem "Adam"
    Me.cboOperator.AddItem "John"
    '----------------------------
    Me.cboQC.AddItem "SUPPLIER"
End Sub
 
awesome

thank you a ton, this is allot of help
 
You're welcome. Glad I can offer some help for you

Another approach if you don't like that. For example
Code:
Private Sub cboPassFail_DropButtonClick()
    'Add This Line To Clear The ComboBox Before Proceeding
    Me.cboPassFail.Clear
    
    Me.cboPassFail.AddItem "PASS"
    Me.cboPassFail.AddItem "FAIL"
End Sub
 
Thank you

thank you very much im glad i have two code options now.
 
Back
Top