ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reset Checkboxes from Control Tool Box (https://www.excelbanter.com/excel-programming/370950-reset-checkboxes-control-tool-box.html)

Robert

Reset Checkboxes from Control Tool Box
 
Norman provided the following code which resets the checkboxes from the Forms
Toolbar. Can someone amend this for me to apply to checkboxes from the
Control Tool Box

Public Sub Tester()
ActiveSheet.CheckBoxes.Value = xlOff
End Sub

Thank you
--
Robert

Norman Jones

Reset Checkboxes from Control Tool Box
 
Hi Robert,

Try:

'=============
Public Sub Tester()
Dim obj As OLEObject

For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MsForms.CheckBox Then
obj.Object.Value = False
End If
Next obj

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


---
Regards,
Norman



"Robert" wrote in message
...
Norman provided the following code which resets the checkboxes from the
Forms
Toolbar. Can someone amend this for me to apply to checkboxes from the
Control Tool Box

Public Sub Tester()
ActiveSheet.CheckBoxes.Value = xlOff
End Sub

Thank you
--
Robert




Robert

Reset Checkboxes from Control Tool Box
 
Thank you Norman,
--
Robert




Robert

Reset Checkboxes from Control Tool Box
 
Hi, Norman, I had attached macros to the CheckBoxes. When the Reset
Macro is executed, the individual macros attached to the CheckBoxes are being
activated aswell. Is there a way to prevent the underlying macros from being
executed.
Thank you.
--
Robert




Norman Jones

Reset Checkboxes from Control Tool Box
 
Hi Robert,

Hi, Norman, I had attached macros to the CheckBoxes. When the Reset
Macro is executed, the individual macros attached to the CheckBoxes are
being
activated aswell. Is there a way to prevent the underlying macros from
being
executed.


Try:

'=============
Public Sub Tester()
Dim obj As OLEObject
Dim Cbox As MsForms.CheckBox

Application.EnableEvents = False
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MsForms.CheckBox Then
obj.Object.Value = False
End If
Next obj
Application.EnableEvents = True
End Sub
'<<=============


---
Regards,
Norman



Robert

Reset Checkboxes from Control Tool Box
 
No luck, Norman, problem persists. Any further response
will be followed up by me in 14 hours time. Anyway, thank you
for your effort. I shall continue to look out.
--
Robert


"

Dave Peterson

Reset Checkboxes from Control Tool Box
 
Try something like this:

'at the top of the General module

Option explicit
Public BlkProc as boolean

Public Sub Tester()
Dim obj As OLEObject
Dim Cbox As MsForms.CheckBox

blkproc = true
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MsForms.CheckBox Then
obj.Object.Value = False
End If
Next obj
blkproc = false
End Sub

Then for each checkbox, you'll have to check the status of the boolean.

Private Sub CheckBox1_Click()

if blkproc = true then exit sub

'rest of your code here

End Sub




Robert wrote:

Hi, Norman, I had attached macros to the CheckBoxes. When the Reset
Macro is executed, the individual macros attached to the CheckBoxes are being
activated aswell. Is there a way to prevent the underlying macros from being
executed.
Thank you.
--
Robert


--

Dave Peterson

Robert

Reset Checkboxes from Control Tool Box
 
Yes,Yes,Yes that did it. Thank you Dave.
Thanks to Norman too.
--
Robert





All times are GMT +1. The time now is 09:06 PM.

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