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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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