ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   'Uncheck button' (https://www.excelbanter.com/excel-programming/414675-uncheck-button.html)

FuriaRi0T

'Uncheck button'
 
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.

FuriaRi0T

'Uncheck button'
 
sorry for the double post - my browser crashed mid-post!

"FuriaRi0T" wrote:

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.


OssieMac

'Uncheck button'
 
Do you mean that you want to remove the check boxes altogether or simply
remove the check mark from the boxes?
--
Regards,

OssieMac


"FuriaRi0T" wrote:

sorry for the double post - my browser crashed mid-post!

"FuriaRi0T" wrote:

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.


FuriaRi0T

'Uncheck button'
 
Just the checkmark itself, not the actual boxes.

"OssieMac" wrote:

Do you mean that you want to remove the check boxes altogether or simply
remove the check mark from the boxes?
--
Regards,

OssieMac


"FuriaRi0T" wrote:

sorry for the double post - my browser crashed mid-post!

"FuriaRi0T" wrote:

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.


Leith Ross[_2_]

'Uncheck button'
 
On Jul 26, 8:52 pm, FuriaRi0T
wrote:
Just the checkmark itself, not the actual boxes.

"OssieMac" wrote:
Do you mean that you want to remove the check boxes altogether or simply
remove the check mark from the boxes?
--
Regards,


OssieMac


"FuriaRi0T" wrote:


sorry for the double post - my browser crashed mid-post!


"FuriaRi0T" wrote:


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.


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

FuriaRi0T

'Uncheck button'
 
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.

"Leith Ross" wrote:

On Jul 26, 8:52 pm, FuriaRi0T
wrote:
Just the checkmark itself, not the actual boxes.

"OssieMac" wrote:
Do you mean that you want to remove the check boxes altogether or simply
remove the check mark from the boxes?
--
Regards,


OssieMac


"FuriaRi0T" wrote:


sorry for the double post - my browser crashed mid-post!


"FuriaRi0T" wrote:


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.


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


OssieMac

'Uncheck button'
 
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


--
Regards,

OssieMac



FuriaRi0T

'Uncheck button'
 
Thank you very much Ossie. Worked like a dream.

"OssieMac" wrote:

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


--
Regards,

OssieMac



Rick Rothstein \(MVP - VB\)[_2407_]

'Uncheck button'
 
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



All times are GMT +1. The time now is 09:22 AM.

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