Hi,
I have a combo box on a Userform (initiated by clicking a command button)that I want to show all the names of the sheets in a workbook - no problem to achieve this - I added the names using AddItem on the Userform Initialise event, then I show the Userform. The inital value shown in the box is the text from the Value parameter of combobox properties which is
"Choose sheet to copy data to -->"
The idea is the user clicks the down arrow and selects a sheet by its name. This all works.
After the sheet is chosen I have the Combobox.Change event set to do its work, so that it immediately hides the box and does the copy. Later the user might repeat the process and here is where I have a problem. I want the combobox to be cleared and a new list created (the user may have added more sheets which are not in the original list). If I don't clear the list then the last chosen value is shown. If I clear the list the Combobox.change event is triggered, I tried putting "Application.EnableEvents = False" before the Combobox.Clear statement but it still run the change event.
I tried this in both the initialise event for the userform and the activate event with the same results.
Is there any way to clear the comboxbox list and re-populate it without the change event code running?
George
I have a combo box on a Userform (initiated by clicking a command button)that I want to show all the names of the sheets in a workbook - no problem to achieve this - I added the names using AddItem on the Userform Initialise event, then I show the Userform. The inital value shown in the box is the text from the Value parameter of combobox properties which is
"Choose sheet to copy data to -->"
The idea is the user clicks the down arrow and selects a sheet by its name. This all works.
After the sheet is chosen I have the Combobox.Change event set to do its work, so that it immediately hides the box and does the copy. Later the user might repeat the process and here is where I have a problem. I want the combobox to be cleared and a new list created (the user may have added more sheets which are not in the original list). If I don't clear the list then the last chosen value is shown. If I clear the list the Combobox.change event is triggered, I tried putting "Application.EnableEvents = False" before the Combobox.Clear statement but it still run the change event.
I tried this in both the initialise event for the userform and the activate event with the same results.
Is there any way to clear the comboxbox list and re-populate it without the change event code running?
George