Macro To Uncheck Checkboxes

clarkerots

New Member
Joined
Mar 29, 2019
Messages
10
Is there a way to have a macro uncheck all checked checkboxes, except for some?

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]X
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

So if every X represents a checkbox, and most of them are checked, I want a macro that clears all the checks, except the checkboxes in row A. Is that possible?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi clarkerots,

You have not given us any useful information as it relates to your sheets and CheckBoxes. That said, and assuming these are ActiveX CheckBoxes, if you know what Worksheets the CheckBoxes appear on and their names, then you can manipulate them with this line(s). Of course you would have to use your Sheet and CheckBox names...

Code:
Worksheets("Sheet1").CheckBox1.Value = False
Worksheets("Sheet1").CheckBox2.Value = True
 
Upvote 0
Hi clarkerots,

You have not given us any useful information as it relates to your sheets and CheckBoxes. That said, and assuming these are ActiveX CheckBoxes, if you know what Worksheets the CheckBoxes appear on and their names, then you can manipulate them with this line(s). Of course you would have to use your Sheet and CheckBox names...

Code:
Worksheets("Sheet1").CheckBox1.Value = False
Worksheets("Sheet1").CheckBox2.Value = True


The macro is going to be associated with a button. It is for all the checkboxes on the active sheet. The checkboxes are all added by form control. So based on the graph, checkbox in A1 would be Checkbox 1, A2 would be CheckBox2, A3 would be CheckBox3, B1 would be CheckBox4, etc. They are all linked to the cell they preside in. So the checkbox in A1 is linked to cell A1. I want to hit a button, and have the macro unchecked (or keep unchecked if there's no current check in the checkbox) the checkboxes in cells B1, B3, and C1. But I want all the checkboxes in column A to be left alone. So if they're checked, they will stay checked. If they're unchecked, they will stay unchecked.

I hope that's clearer.
 
Upvote 0
Is this close to what you want...

Code:
Sub cBoxes()


    Dim ws As Worksheet: Set ws = ActiveSheet
    Dim item As Object
    
    For Each item In ws.Shapes
        If Not Mid(item.DrawingObject.LinkedCell, 2, 1) = "A" Then
            item.DrawingObject.Value = 0
            ws.Range(item.DrawingObject.LinkedCell).ClearContents
        End If
    Next
    
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
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