ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Checkbox Clearing (https://www.excelbanter.com/excel-programming/347357-excel-checkbox-clearing.html)

gotgame0314

Excel Checkbox Clearing
 

I have a sheet with checkboxes that were placed from the contro
toolbox. Is there a way to clear all the checkboxes on the sheet usin
a command button

Thank

--
gotgame031
-----------------------------------------------------------------------
gotgame0314's Profile: http://www.excelforum.com/member.php...fo&userid=2937
View this thread: http://www.excelforum.com/showthread.php?threadid=49081


Norman Jones

Excel Checkbox Clearing
 
Hi GotGame,

Try assigning the following code to the command button:

'=============
Sub Tester01()
Dim Ctl As OLEObject

For Each Ctl In Worksheets("Sheet1").OLEObjects
If TypeOf Ctl.Object Is MSForms.CheckBox Then
Ctl.Object.Value = False
End If
Next Ctl
End Sub
'<<=============


---
Regards,
Norman



"gotgame0314"
wrote in message
...

I have a sheet with checkboxes that were placed from the control
toolbox. Is there a way to clear all the checkboxes on the sheet using
a command button

Thanks


--
gotgame0314
------------------------------------------------------------------------
gotgame0314's Profile:
http://www.excelforum.com/member.php...o&userid=29373
View this thread: http://www.excelforum.com/showthread...hreadid=490811




Dave Peterson

Excel Checkbox Clearing
 
Or just use it as:

Sub CommandButton1_Click()
(still under that same worksheet)


Norman Jones wrote:

Hi GotGame,

Try assigning the following code to the command button:

'=============
Sub Tester01()
Dim Ctl As OLEObject

For Each Ctl In Worksheets("Sheet1").OLEObjects
If TypeOf Ctl.Object Is MSForms.CheckBox Then
Ctl.Object.Value = False
End If
Next Ctl
End Sub
'<<=============

---
Regards,
Norman

"gotgame0314"
wrote in message
...

I have a sheet with checkboxes that were placed from the control
toolbox. Is there a way to clear all the checkboxes on the sheet using
a command button

Thanks


--
gotgame0314
------------------------------------------------------------------------
gotgame0314's Profile:
http://www.excelforum.com/member.php...o&userid=29373
View this thread: http://www.excelforum.com/showthread...hreadid=490811


--

Dave Peterson


All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com