I Need Macro Code To Make A Button To Uncheck All Checked Boxes ... None Of The Checkboxes Are Named

dkeagy

New Member
Joined
Jan 28, 2013
Messages
2
I Need Macro Code To Make A Button To Uncheck All Checked Boxes ... None Of The Checkboxes Are Named

Please Help - Thanks :)
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Seeing as you don't specify what type of checkboxes they are try this macro by Erik.Van.Geit.

Code:
Sub uncheck_all()
Dim sh As Shape
Application.ScreenUpdating = False
    For Each sh In ActiveSheet.Shapes
      If sh.Type = msoOLEControlObject Then
        If TypeName(sh.OLEFormat.Object.Object) = "CheckBox" Then sh.OLEFormat.Object.Object = False
      End If
      If sh.Type = msoFormControl Then
        If sh.FormControlType = xlCheckBox Then sh.OLEFormat.Object = False
      End If
    Next sh
Application.ScreenUpdating = True
End Sub
 
Upvote 0
It worked!!! THANK YOU SO MUCH!!! :)





Seeing as you don't specify what type of checkboxes they are try this macro by Erik.Van.Geit.

Code:
Sub uncheck_all()
Dim sh As Shape
Application.ScreenUpdating = False
    For Each sh In ActiveSheet.Shapes
      If sh.Type = msoOLEControlObject Then
        If TypeName(sh.OLEFormat.Object.Object) = "CheckBox" Then sh.OLEFormat.Object.Object = False
      End If
      If sh.Type = msoFormControl Then
        If sh.FormControlType = xlCheckBox Then sh.OLEFormat.Object = False
      End If
    Next sh
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Happy it gave you a solution but like I implied the code is doing more than it needs to (especially if the checkboxes are form controls)
 
Upvote 0

Forum statistics

Threads
1,216,471
Messages
6,130,822
Members
449,595
Latest member
jhester2010

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top