View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Events firing willy nilly

You would probably need to set a global flag to determine how the control is
being changed. It could get pretty cumbersome with multiple controls. Here's
some untested pseudocode:

Dim fSwitch As Boolean

Sub cmbName_Change()
fSwitch = True
'make changes to cmbType
fSwitch = False
End Sub

Sub cmbType_Change()
If fSwitch = True Then Exit Sub
'your code here
End Sub

You get the idea.

--

Vasant







"Darren Hill" wrote in message
...
[Excel2000]
I have a form with a number of comboboxes and listboxes on it.
Some of these controls change the values of other controls, causing their
events to trigger. I want to stop this in some cases. Has anyone got any
suggestions?

For example, cmbName is changed, and this changes everything else

including
cmbType.
But cmbType has a macro that I only want to run when cmbType is manually
changed, but not when its value is changed by another event.

Is it possible to achieve this?

TIA
Darren