Hi
I am very new to excel.
I want to create 2 checkbox that when any of it checked, another 1 checkbox at another worksheet will be checked also.
I would also like for it to be cleared when unchecked.
I would appreciate the help.
Thanks
Hi
I am very new to excel.
I want to create 2 checkbox that when any of it checked, another 1 checkbox at another worksheet will be checked also.
I would also like for it to be cleared when unchecked.
I would appreciate the help.
Thanks
Re: One checkbox being checked another checkbox is also checked.
You will need to create your CheckBoxes using the Controls Toolbox. This creates controls on the sheet of the form =EMBED("Forms.CheckBox.1","") and makes it easy to attach VBA code.
So having created 3 CheckBoxes as follows:
Sheet1: CheckBox1 and CheckBox2
Sheet2: CheckBox1
You then need to add the following VBA to the code sheet for Sheet1. To do this, right click on the tab for Sheet1 and select View Code.
Option Explicit
Private Sub CheckBox1_Click()
If CheckBox1 Then
Sheet2.CheckBox1 = True
ElseIf Not (CheckBox1) And Not (CheckBox2) Then
Sheet2.CheckBox1 = False
End If
End Sub
Private Sub CheckBox2_Click()
If CheckBox2 Then
Sheet2.CheckBox1 = True
ElseIf Not (CheckBox1) And Not (CheckBox2) Then
Sheet2.CheckBox1 = False
End If
End Sub
Display More
Attaching a workbook with an example.
Re: Link checkboxes between multiple sheets
You don't necessarily need VBA for this, however, it depends on what you are going to do with the checkboxes
If you use checkboxes from the Forms controls and set the linked cell to the same cell on, say, sheet1, then both checkboxes will be linked and show checked/unchecked in tandem. This approach requires no VBA.
If you need to perform additional actions via code, then a checkbox from the Active-X controls *might* be needed.
Re: Link checkboxes between multiple sheets
AAE,
Ah now I couldn't work out how to combine the outputs of CheckBox1 & CheckBox 2 on Sheet1 to create the value of the CheckBox on the second sheet using Forms controls. At least not in a reliable way.
Don’t have an account yet? Register yourself now and be a part of our community!