Use VBA to Uncheck all Check Boxes

StuLux

Well-known Member
Joined
Sep 14, 2005
Messages
679
Office Version
  1. 365
Platform
  1. Windows
Despite extensive searching of this board I cannot find code to do the following:

I have a worksheet with several check boxes on it (check boxes inserted using the Forms toolbar). I want to be able to uncheck all boxes on the sheet using VBA as a way of resetting the sheet, can anybody help.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Perhaps:

Code:
Sub ClearChecks()

  Dim CB As Object

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

End Sub


This works also:

Code:
Sub ClearChecks()
    ActiveSheet.CheckBoxes.Value = xlOff
End Sub
 
Last edited:
Upvote 0
Thanks Adam, I used your second bit of code and it works fine. I was getting stuck with trying to set the value of the checkboxes to FALSE instead of xlOff.
 
Upvote 0
Your welcome,

PS i got stuck too, had to look it up in the help files!

:)
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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