Checkbox for checking all checkboxes

FTK

New Member
Joined
Nov 30, 2005
Messages
4
What would the macro be to have a checkbox 'select all' checkboxes within a range of cells? (the checkboxes are linked to the cells)
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Bump

Man this board moves fast. Again, I'm looking for a macro (I think that's the right terminology) to allow one checkbox select 'all' checkboxes in a particular column.
 
Upvote 0
Basically if you make the cells the checkboxes are linked too 'TRUE' all checkboxes will be checked
So... the following code should work.

Just assign it to a button:

Change the range to fit the range where your cell links are....

Sub CheckAll()
Dim MyRange As Range
Set MyRange = Range("H12:H16")

For Each c In MyRange
c.Value = True
Next c
End Sub
 
Upvote 0
Sweet. It worked. How do I make it so when I 'uncheck' the box the cells are set to FALSE?
 
Upvote 0
Assuming H10 is the cell your master checkbox is linked too:

Sub CheckAll()
Dim MyRange As Range
Set MyRange = Range("H12:H16")

For Each c In MyRange
If Range("H10").Value = True Then
c.Value = True
Else: c.Value = False
End If
Next c
End Sub

Again change the range to fit your needs.
 
Upvote 0

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

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