Linked Check Boxes

B

blueegypt

I am trying to set up a spreadsheet for visual purposes only, may in the
future be connected to another system, but I am having a problem with setting
up the check boxes the way I would like.
The spreadsheet is to layout the way a permissions selection or security
selection does in a networked software package.
Let’s say each permission has 4 columns, A B C & D all are check boxes.
If I check A I would like B C & D to automatically receive a check mark.
But if I check C, only C & D will receive a check and not A & B.
If that makes sense to you and you have any idea how I can make this work
please let me know.
I already know how to link each check box to a cell but I cannot get it to
leave the ones, preceding the box I check, blank.
 
E

Edwin Tam

You need to write macros and assign macros to the checkboxes. (However,
please note that the majority of the logic is missing in your question.)

- First of all, you go to Visual Basic Editor. (From the tools menu, choose
macros, the VB Editor)
- Locate your file in the project explorer, insert a module to it
- paste the following sample code:

Sub A_Clicked()
With ActiveSheet
If .CheckBoxes("Check Box 1").Value = xlOn Then
.CheckBoxes("Check Box 2").Value = xlOn
.CheckBoxes("Check Box 3").Value = xlOn
.CheckBoxes("Check Box 4").Value = xlOn
Else
'do something
End If
End With
End Sub

Sub C_Clicked()
With ActiveSheet
If .CheckBoxes("Check Box 3").Value = xlOn Then
.CheckBoxes("Check Box 4").Value = xlOn
.CheckBoxes("Check Box 1").Value = xlOff
.CheckBoxes("Check Box 2").Value = xlOff
Else
'do something
End If
End With
End Sub

- Now, go back to your worksheet. Ctrl-click your checbox A, and assign the
"A_Checked" macro to it.
- For checkbox C, assign "C_Clicked" to it.

If you need to look at a sample file, I put one at:
http://www.vonixx.com/excel/checkboxes.xls

Regards,
Edwin Tam
(e-mail address removed)
http://www.vonixx.com
 

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