ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel and Visual Basic (https://www.excelbanter.com/excel-programming/365331-excel-visual-basic.html)

arand

Excel and Visual Basic
 
Hello,

I am trying to create a command button in Microsoft Excel (Office 2000) that
enables me to reset the check box status for a worksheet from checked to
unchecked. The worksheet contains approximately 50 check boxes and is meant
to be reused. Is this possible? If so, how can I program it to do so? Thanks.

Leith Ross[_604_]

Excel and Visual Basic
 

Hello Arand,

Copy this macro into a VBA module and then attach the macro to your
command button. It will clear all chekboxes on the active worksheet
automatically.


Code:
--------------------

Sub ClearCheckBoxes()

Dim AutoShape

For Each AutoShape In ActiveSheet.Shapes
If AutoShape.Type = msoFormControl Then
If AutoShape.FormControlType = xlCheckBox Then
AutoShape.ControlFormat.Value = False
End If
End If
Next AutoShape

End Sub
--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=555428


Norman Jones

Excel and Visual Basic
 
Hi Arand,

Assuming that the checkboxes are from the Forms toolbar, try:

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


---
Regards,
Norman


"arand" <u23437@uwe wrote in message news:62531f4ca81e7@uwe...
Hello,

I am trying to create a command button in Microsoft Excel (Office 2000)
that
enables me to reset the check box status for a worksheet from checked to
unchecked. The worksheet contains approximately 50 check boxes and is
meant
to be reused. Is this possible? If so, how can I program it to do so?
Thanks.





All times are GMT +1. The time now is 10:28 AM.

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