Select All checkboxes

N

Nikki

Hi,

I'd like to create a button that will "select all" checkboxes on a
given worksheet. When I searched this group, I came across this
posting that looks like exactly what I need:
http://groups.google.com/group/micr...=gst&q=select+all+checkboxes#fdf0c0b1eaded911

However, I am not familiar with Visual Basic programming. When I
copied and pasted the code, I get an error at start of the For Each
command. What are "ctrl", "UserForm1" and "MSForms" pointing to? I
assume those are the variables to be set. How do I set them?

I appreciate any help or pointers where to search for help.

Thank you,
Nikki
 
D

Dave Peterson

That thread dealt with checkboxes on a userform--not checkboxes placed on a
worksheet.

Where did you get your checkboxes that you placed on the worksheet--did you use
the checkboxes from the Forms toolbar or did you use the checkboxes from the
Control toolbox toolbar?
 
N

Nikki

Dave,

I used the checkboxes from the Forms toolbar.

I was unaware of a difference of a worksheet and userform; I am not
familiar with userforms.

Thank you,
Nikki
 
D

Dave Peterson

Userforms are those things that look a lot like the Tools|Options dialog.

You could assign a macro like this to that master checkbox:

Option Explicit
Sub ToggleCheckboxes()
Dim MstrCBX As CheckBox
Set MstrCBX = ActiveSheet.CheckBoxes(Application.Caller)
ActiveSheet.CheckBoxes.Value = MstrCBX.Value
End Sub
 
N

Nikki

Thank for your reply. Once I found out how to assign a macro to a
checkbox, this code worked perfectly.

Also, thank you for clarifying what a userform is. I did not know
Excel could do something like that. Guess we learn a lot more than one
thing each day!

Nikki
 

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