ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet Checkboxes clear (https://www.excelbanter.com/excel-programming/339709-sheet-checkboxes-clear.html)

pete

Sheet Checkboxes clear
 
how do i set a macro to clear checkboxes that are on sheet1 of my workbook.

i would like to do this with a macro because there are about 50 of them.

Norman Jones

Sheet Checkboxes clear
 
Hi Pete,

If the checkboxes are from the Forms Toolbar, then try:

ActiveSheet.CheckBoxes = False

If they are from the Control Toolbox, try:

'=======================
Public Sub Tester01()
Dim sh As Worksheet
Dim oleObj As OLEObject

Set sh = ActiveSheet

For Each oleObj In sh.OLEObjects
If TypeOf oleObj.Object Is MSForms.CheckBox Then
oleObj.Object.Value = False

End If
Next oleObj

End Sub
'<<=======================

---
Regards,
Norman



"Pete" wrote in message
...
how do i set a macro to clear checkboxes that are on sheet1 of my
workbook.

i would like to do this with a macro because there are about 50 of them.




pete

Sheet Checkboxes clear
 
Thanks Norman - they were from the forms toolbar and
ActiveSheet.CheckBoxes = False
worked

"Norman Jones" wrote in
:

Hi Pete,

If the checkboxes are from the Forms Toolbar, then try:

ActiveSheet.CheckBoxes = False

If they are from the Control Toolbox, try:

'=======================
Public Sub Tester01()
Dim sh As Worksheet
Dim oleObj As OLEObject

Set sh = ActiveSheet

For Each oleObj In sh.OLEObjects
If TypeOf oleObj.Object Is MSForms.CheckBox Then
oleObj.Object.Value = False

End If
Next oleObj

End Sub
'<<=======================

---
Regards,
Norman



"Pete" wrote in message
...
how do i set a macro to clear checkboxes that are on sheet1 of my
workbook.

i would like to do this with a macro because there are about 50 of
them.







All times are GMT +1. The time now is 11:48 PM.

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