Use VBA to Uncheck all Check Boxes

StuLux

Well-known Member
Joined
Sep 14, 2005
Messages
604
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.
 

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,166
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:

StuLux

Well-known Member
Joined
Sep 14, 2005
Messages
604
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.
 

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,166
Your welcome,

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

:)
 

Forum statistics

Threads
1,082,632
Messages
5,366,674
Members
400,912
Latest member
Click22

Some videos you may like

This Week's Hot Topics

Top