Easiest way to check/uncheck all checkboxes?

mae0429

Board Regular
Joined
Jun 12, 2008
Messages
114
Hi all,

I've got an embedded chart on a worksheet and it has 24 checkboxes (control toolbox, not form) corresponding to different devices. How would I go about linking another checkbox to select or unselect all the boxes?

I know it could generally be something like:

Code:
Private Sub checkbox_Click()
    Select Case checkbox.Value
        Case True
            Make all the other checkboxes true
        Case False
            Make all the other checkboxes false
    End Select
End Sub

And how the heck do I refer to the checkboxes?!?

Thanks!
-Matt
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Solved.

Code:
Sub MatchCheckbox()
    Dim s As Shape
    Dim i As Long
    Worksheets("Chart").ChartObjects(1).Activate
    With ActiveChart
        For i = 8 To 31
            .Shapes(i).ControlFormat.Value = .Shapes(32).ControlFormat.Value
        Next i
    End With
End Sub
 
Upvote 0
Hello Matt, a technical question for you please on a separate matter.

It appears you placed the checkboxes directly onto the chart object, and you used the word "embedded" in your first post, but I think to refer to the chart to the sheet, not the checkboxes to the chart. ??

My question is, and I could be wrong so I'm asking, I thought that controls from the activex control toolbox could not be embedded onto a chart. I know they can be placed on the chart, but if you were to also place a checkbox from the Forms toolbar onto the chart, that Forms checkbox would be embedded, in the sense that if you drag the chart to somewhere else on the sheet, the Forms checkbox stays in its original location on the chart object because it truly is embedded on the chart, whereas the activex checkbox stays in its location on the worksheet and is not moved along with the chart because it truly is not embedded onto the chart.

Is that your experience...that if you drag the chart object to another location on the sheet, those activex checkboxes you speak of do not follow with it? I just want to see if you are able to embed an activex object onto a chart because I did not know that was possible.

Thanks !!
 
Upvote 0
I came across this very issue and found there are two methods for placing checkboxes on charts, and the behavior is differs depending on which you choose: if you don't have the chart activated and you place a checkbox (or other control), the checkbox is independent of the chart and will not move around with the chart (it's actually on the sheet). If you have the chart activated and place the control, it will move around with the chart. The only downside to this is that when I tried to link the checkboxes to their output cells, Excel crashed just about every other time. Once I got them settled it worked fine, but Excel made it clear it did not like what I was doing. It would save a recovery version and crash, then the recovery version's chart acted as an image, not a chart (couldn't tick the boxes). Quite frustrating to say the least.

Short answer: yes, the boxes will move, but you have to have the chart activated when you place them. Hope that helps!
 
Upvote 0
Thanks for responding. I'm still not 100% clear on the activation thing, I just tried putting an activex checkbox on a chart with the chart being active and not active and get the same result, which is the checkbox not being embedded. They can be sent to the front and all that, just not moved with the chart and truly embedded.

If you have accomplished this and can send me an example I'd really appreciate it, my email address is get-able on my site through the Contact link on my user name here, or you can PM me and I can send you my email address. In any case thanks a lot for the info.
 
Upvote 0
Just emailed an example book to you. It'll be from a Matthew at a gmail address. It shows 2 charts: one is a default chart and one has checkboxes that change what info is displayed. It should be easy enought to figure out, but if you have any questions don't hesitate to ask.

-Matt
 
Upvote 0

Forum statistics

Threads
1,216,404
Messages
6,130,376
Members
449,578
Latest member
TT123

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