Excel CheckBox on UserForm Event Loops

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have created an Excel UserForm with multiple checkboxes. I am noticing
some strange behavior in that this control keeps firing the Click / Change
Event every time I change the controls.value property - enn in other code.

I did notice a support article stating this on MSDN after much pulling hair.

I am wondering if anyone out there has had this happen and am wondering how
you got around it. Currently, I have public variables set to bypass the event
code, but I would think there is a better way.

Example:
sub chkbox1.Change()
Set_Control()
end

sub chkbox2.Change()
Set_Control()
end
....

sub Set_Control
Use tabindex to also set values for other check boxes in different frames.
other.value = True (or false)
end sub

I notice that the change event fires again after set control which then
initiates Set Control again. It doesn't cause an endless loop but fires
routine twice.

Anyone have any ideas?
A relatively simple userform has taken days to get the controls to work
right because of this issue.

Thanks
 
Vraiables is the standard way

sub chkbox1.Change()
Static FControl As Boolean
If Not fBoolean Then
fBoolean = True
Set_Control
fBoolean = False
End If
End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top