Macro or VBA Code to un tick CheckBox

G

Guest

Dear All,

I have few checkbox at one tab of spreadsheet that assigned with few macro
if I tick that Checkbox.

Now, If I want to untick all that "ticked" Checkbox automatically by using
Macro/vba code, is there any vba code that I can use ?

I try to use macro recording to untick those checkbox, but it does not work.

Highly Appreciate for any comment and help,

Thansk alot,

PA
 
L

Leith Ross

Dear All,

I have few checkbox at one tab of spreadsheet that assigned with few macro
if I tick that Checkbox.

Now, If I want to untick all that "ticked" Checkbox automatically by using
Macro/vba code, is there any vba code that I can use ?

I try to use macro recording to untick those checkbox, but it does not work.

Highly Appreciate for any comment and help,

Thansk alot,

PA

Hello PA,

Here are 2 macros to do the job. The first macro is for Control
Toolbox CheckBoxes, like the ones on a UserForm, and the Excel
Worksheet only Forms Checkboxes.

'Begin Macro Code...
Sub ClearCheckBoxes1()

' This macro clears all Control Toolbox CheckBoxes on the
ActiveSheet
Dim CB As Object

For Each CB In ActiveSheet.OLEObjects
If TypeName(CB.Object) Like "CheckBox" Then
CB.Object.Value = ""
End If
Next CB

End Sub

Sub ClearCheckBoxes2()

' This macro clears all Forms CheckBoxes on the ActiveSheet
Dim CB As Object

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

End Sub
'End Macro Code

Sincerely,
Leith Ross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top