View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Events firing willy nilly

Darren,

I don't know of any "disable control events" parameter.
One way is to have a global Boolean variable which tells other events
whether something's already going on.

eg.

Private i As Long
Private blnExecuting As Boolean

Private Sub TextBox1_Change()
If blnExecuting Then Exit Sub
blnExecuting = True
i = i + 1
TextBox2.Text = Left(TextBox1.Text, 1) & i
blnExecuting = False
End Sub

Private Sub TextBox2_Change()
If blnExecuting Then Exit Sub
blnExecuting = True
i = i + 1
TextBox1.Text = Left(TextBox2.Text, 1) & i
blnExecuting = False
End Sub


Rob


"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