View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Jonathan Brown Jonathan Brown is offline
external usenet poster
 
Posts: 47
Default Set value of checkbox on userform without triggering Click eve

Oh yeah, well that makes sense. Now, I'm wondering what
application.enableevents does exactly. Don't worry, you don't have to answer
that. I'll look it up. Thanks again!

"Dave Peterson" wrote:

Another way is to use a variable that acts like application.enableevents would
for worksheet/workbook events.

Inside your userform module:
Option Explicit
Dim BlkProc As Boolean
Private Sub CheckBox1_Change()
BlkProc = True
If Me.CheckBox1.Value = True Then
Me.CheckBox2.Value = True
Me.CheckBox3.Value = True
End If
BlkProc = False
End Sub
Private Sub CheckBox2_Change()
If BlkProc = True Then Exit Sub
'other code here
End Sub
Private Sub CheckBox3_Change()
If BlkProc = True Then Exit Sub
'other code here
End Sub

Checkbox1 was my master checkbox.


Jonathan Brown wrote:

I have a userform with several checkboxes on it. I have one "master"
checkbox that is supposed to be able to set all checkboxes true or false
based on its own state. So basically, if master checkbox is true then set
all checkboxes true, else if it's false then set all checkboxes false.

The annoying thing though is when it sets the value of each individual
checkbox it runs the code associated with each checkbox's click event. This
is slowing down my spreadsheet considerably.

Is it possible to set the value of a checkbox without Excel executing the
code associated with it's click event?


--

Dave Peterson