Excel and Visual Basic

A

arand

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.
 
L

Leith Ross

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
 
N

Norman Jones

Hi Arand,

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top