View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Excel CheckBox on UserForm Event Loops

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)


"ptnagle" wrote in message
...
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
--
ptnagle