View Single Post
  #5   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

Ryan,

I'm having trouble using the Checkboxes collection of the Userform1. It
doesn't appear to be a valid collection. When I run the code I get an error
and it highlights that line.

I tried to modify it to look like below but it didn't work either.

Sub ClearCheckBoxes()
Dim ChkBox As Checkbox

For Each ChkBox In UserForm1.Controls
If ChkBox.ControlType = xlCheckbox Then
ChkBox.Value = xlOff
End If
Next ChkBox

End Sub

Is there some sort of a reference I need to include that I'm missing in
order for it to recognize the .CheckBoxes collection of the userform?

Thanks

"ryguy7272" wrote:

Sub ClearCheckBoxes()
'Me.ListBox1.Clear...for ListBoxes
Dim ChkBox As Object

For Each ChkBox In UserForm1.CheckBoxes
ChkBox.Value = xlOff
Next ChkBox

End Sub

Sub EnterCheckBoxes()
'Me.ListBox1.Clear...for ListBoxes
Dim ChkBox As Object

For Each ChkBox In UserForm1.CheckBoxes
ChkBox.Value = xlOn
Next ChkBox

End Sub

HTH
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"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?