Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox question
I have many, many, many check boxes on a worksheet. Under certain conditions
when the sheet is activated, I need to uncheck ALL the checkboxes. Without naming each checkbox individually How can I do this in a loop? thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox question
Try this
Dim CB As OLEObject For Each CB In ActiveSheet.OLEObjects If TypeName(CB) = "CheckBox" Then CB.Object.Value = False End If Next CB -- Regards Juan Pablo González "Sheldon" wrote in message ... I have many, many, many check boxes on a worksheet. Under certain conditions when the sheet is activated, I need to uncheck ALL the checkboxes. Without naming each checkbox individually How can I do this in a loop? thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox question
Dave Peterson posted this
And if you used checkboxes from the Forms toolbar (on a worksheet): ActiveSheet.CheckBoxes.Value = xlOn 'xlOff -- Regards Ron de Bruin http://www.rondebruin.nl "Juan Pablo González" wrote in message ... Try this Dim CB As OLEObject For Each CB In ActiveSheet.OLEObjects If TypeName(CB) = "CheckBox" Then CB.Object.Value = False End If Next CB -- Regards Juan Pablo González "Sheldon" wrote in message ... I have many, many, many check boxes on a worksheet. Under certain conditions when the sheet is activated, I need to uncheck ALL the checkboxes. Without naming each checkbox individually How can I do this in a loop? thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox question
Both solutions offers did not work!
"Sheldon" wrote: I have many, many, many check boxes on a worksheet. Under certain conditions when the sheet is activated, I need to uncheck ALL the checkboxes. Without naming each checkbox individually How can I do this in a loop? thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox question
Ok, I missed one thing in the previous code. This should work ok:
Sub Uncheck() Dim CB As OLEObject With Sheets("Sheet1") For Each CB In .OLEObjects If TypeName(CB.Object) = "CheckBox" Then CB.Object.Value = False End If Next CB End With End Sub -- Regards Juan Pablo González "Sheldon" wrote in message ... they were created using the Control Toolbox. Sheldon "Juan Pablo González" wrote: Ok, which toolbar did you use to create the checkbox ? -- Regards Juan Pablo González "Sheldon" wrote in message ... Both solutions offers did not work! "Sheldon" wrote: I have many, many, many check boxes on a worksheet. Under certain conditions when the sheet is activated, I need to uncheck ALL the checkboxes. Without naming each checkbox individually How can I do this in a loop? thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox question
Sir,
Can the same code be used if the checkboxes are on a userform? Can similiar code be used for optionbuttons? Thank you dtn "Juan Pablo González" wrote: Ok, I missed one thing in the previous code. This should work ok: Sub Uncheck() Dim CB As OLEObject With Sheets("Sheet1") For Each CB In .OLEObjects If TypeName(CB.Object) = "CheckBox" Then CB.Object.Value = False End If Next CB End With End Sub -- Regards Juan Pablo González "Sheldon" wrote in message ... they were created using the Control Toolbox. Sheldon "Juan Pablo González" wrote: Ok, which toolbar did you use to create the checkbox ? -- Regards Juan Pablo González "Sheldon" wrote in message ... Both solutions offers did not work! "Sheldon" wrote: I have many, many, many check boxes on a worksheet. Under certain conditions when the sheet is activated, I need to uncheck ALL the checkboxes. Without naming each checkbox individually How can I do this in a loop? thanks |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
CheckBox question
'-----------------------------------------------------------------
Private Sub ClearCheckboxes() '----------------------------------------------------------------- Dim ctl As msforms.Control For Each ctl In Me.Controls If TypeName(ctl) = "CheckBox" Then ctl.Value = False End If Next ctl End Sub -- HTH RP (remove nothere from the email address if mailing direct) "dtn" wrote in message ... Sir, Can the same code be used if the checkboxes are on a userform? Can similiar code be used for optionbuttons? Thank you dtn "Juan Pablo González" wrote: Ok, I missed one thing in the previous code. This should work ok: Sub Uncheck() Dim CB As OLEObject With Sheets("Sheet1") For Each CB In .OLEObjects If TypeName(CB.Object) = "CheckBox" Then CB.Object.Value = False End If Next CB End With End Sub -- Regards Juan Pablo González "Sheldon" wrote in message ... they were created using the Control Toolbox. Sheldon "Juan Pablo González" wrote: Ok, which toolbar did you use to create the checkbox ? -- Regards Juan Pablo González "Sheldon" wrote in message ... Both solutions offers did not work! "Sheldon" wrote: I have many, many, many check boxes on a worksheet. Under certain conditions when the sheet is activated, I need to uncheck ALL the checkboxes. Without naming each checkbox individually How can I do this in a loop? thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checkbox Question | Excel Discussion (Misc queries) | |||
Checkbox Question | Excel Discussion (Misc queries) | |||
Checkbox question | Excel Discussion (Misc queries) | |||
quick question on a checkbox | Excel Programming | |||
CheckBox (unclicking) Question | Excel Programming |