Stop combobox_click code running when the code changes the value

BrianJones

New Member
Joined
Dec 30, 2009
Messages
1
Hi,

I have several combo boxes with varible lists of data; modifiying combobox1 causes the list in combobox2 to be updated. The problem I have is that when the code from combobox1 updates combobox2 I finish with the line below (this line just makes the combobox2.value equal the first value in its list)

Combobox2.value = combobox2.list(0)

using the code to change the combobox2.value causes the:

sub combobox2_click()

code to run, which bascilly abandons the remaining code in:

sub combobox1_click()

and runs extra code I don't want.


Does anyone know how to stop this code automatically activating so? Afterall I am using the sub *_click and not sub*_change.

Why does changing the value make the code think it has been clicked?

Thanks

Brian
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Put your code between EnableEvents lines.
Use this with care because it is a global setting and while =False stops ANY Excel event.
Rich (BB code):
<CODE>
<CODE>Application.EnableEvents = False</CODE>
<CODE>'- YOUR CODE GOES HERE</CODE>
<CODE>Application.EnableEvents = True</CODE>
 
 


</PRE></CODE>
 
Upvote 0

Forum statistics

Threads
1,215,766
Messages
6,126,754
Members
449,336
Latest member
p17tootie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top