Clear button adds to combo box lists

  • Thread starter Thread starter alann2
  • Start date Start date
A

alann2

Hi all,
when I press the clear button on my user form it repopulates the
combo box list when I press the clear button.

For instance when I operate

Private Sub cmdClearForm_Click()

Call UserForm_Initialize

End Sub

It adds the same information again to my drop down lists. i.e I have 5
names, when I press the clear button once, I get ten names, this is
repaeted ad infinitum.

What am I doing wrong?

excel 2003 all updated on WinXP PRO

Thank you all.

ALan.
 
It sounds like you are using Additem. If so, you need to remove the existing
entires first.


Combobox1.Clear
for i = 1 to 5
Combobox1.AddItem "Item " & i
Next

as an example.
 
The code that fills the list box add this to the top

list1.clear

This way it will clear it each time the code is calle
 
That was just what I needed.
No doubt I'll be calling on youor services again.
I only started Trying to Program Yesterday morning.

Alan.
 
Back
Top