'Uncheck button'

  • Thread starter Thread starter FuriaRi0T
  • Start date Start date
F

FuriaRi0T

I've made an 'uncheck button' within Excel... I want this button to remove
all checkboxes on the page. How would I go about doing this? There are 112
checkboxes in which the button would need to remove.
 
Do you mean that you want to remove the check boxes altogether or simply
remove the check mark from the boxes?
 
Just the checkmark itself, not the actual boxes.

OssieMac said:
Do you mean that you want to remove the check boxes altogether or simply
remove the check mark from the boxes?
 
Just the checkmark itself, not the actual boxes.

Hello FuriaRiOT,

If the Check Boxes are the Forms type and located on the same
worksheet then you can attach this macro to your button. Copy this
code to a standard VBA module in your workbook's VBA project.

Sub ClearCheckBoxes()

Dim ChkBox As Object

For Each ChkBox In ActiveSheet.CheckBoxes
ChkBox.Value = xlOff
Next ChkBox

End Sub

Sincerely,
Leith Ross
 
It doesn't appear to have worked. If I'm supposed to manipulate the code in
someway, pardon my 'green horn'ness, but I'm not sure how.
 
If you used ActiveX checkboxes then this:-

Sub UnCheckBoxesActiveX()

Dim objChkBox As OLEObject
With Sheets("Sheet1")
For Each objChkBox In .OLEObjects
If TypeName(objChkBox.Object) = "CheckBox" Then
objChkBox.Object.Value = False
End If
Next
End With
End Sub
 
If the Check Boxes are the Forms type and located on the same
worksheet then you can attach this macro to your button. Copy this
code to a standard VBA module in your workbook's VBA project.

Sub ClearCheckBoxes()

Dim ChkBox As Object

For Each ChkBox In ActiveSheet.CheckBoxes
ChkBox.Value = xlOff
Next ChkBox

End Sub

Apparently the OP's CheckBoxes were ActiveX ones as he thank OssieMac for
his code; however, for your future reference, with CheckBoxes from the Forms
toolbar, you don't have to iterate each CheckBox individually to uncheck
them all, you can do it by executing a single line of code....

Sub ClearCheckBoxes()
ActiveSheet.CheckBoxes.Value = xlOff
End Sub

or, if on a sheet other than the ActiveSheet (Sheet1 for example)...

Sub ClearCheckBoxes()
Worksheets("Sheet1").CheckBoxes.Value = xlOff
End Sub

Rick
 
Back
Top