Checkbox <if> <or> <and> formulas

TeodoraNenova

New Member
Joined
Apr 5, 2012
Messages
5
Hi, I have 7 ActiveX checkboxes and I would like to write a code to represent the following:

If Checkbox1.Value = True <OR> CheckBox2.Value = True Then Checkbox 5.Value = True
Else CheckBox5.Value = False

If checkbox 3.Value = True <OR> Checkbox4.Value = True <And> Checkbox5.Value = False Then Checkbox6. Value = True
Else Checkbox6.Value = False

If Checkbox5 <AND> Checkbox6 both = False Then Checkbox7.Value = True

--
Is this possible? Thanks!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
When do you want to run your code? It would look like this:

Code:
    CheckBox5.Value = (CheckBox1.Value = True And CheckBox2.Value = True)
    CheckBox6.Value = (CheckBox3.Value = True And CheckBox4.Value = True And CheckBox5.Value = False)
    CheckBox7.Value = (CheckBox5.Value = False And CheckBox6.Value = False)
 
Upvote 0
Sorry, now I see my post did not come right. here is waht I want to do:

I have 7 ActiveX checkboxes and I would like to write a code to represent the following:

If Checkbox1.Value = True OR <OR>CheckBox2.Value = True Then Checkbox 5.Value = True
Else CheckBox5.Value = False

If checkbox 3.Value = True OR <OR>Checkbox4.Value = True AND <AND>Checkbox5.Value = False Then Checkbox6. Value = True
Else Checkbox6.Value = False

If Checkbox5 AND <AND>Checkbox6 both = False Then Checkbox7.Value = True

--
Is this possible? Thanks!
<!-- / message -->
 
Upvote 0
Sure:

Code:
    CheckBox5.Value = (CheckBox1.Value = True Or CheckBox2.Value = True)
    CheckBox6.Value = ((CheckBox3.Value = True Or CheckBox4.Value = True) And CheckBox5.Value = False)
    CheckBox7.Value = (CheckBox5.Value = False And CheckBox6.Value = False)
 
Upvote 0
What happens with that code is, when I check box 1 or 2, then I am allowed to also check 5 (if 1 or 2 are flase, I cannot put a tick on 5). But what I need is, when 1 or 2 is checked, then 5 is also automatically checked. Similar for boxes 6 and 7. Would you know how to do that? Thanks a lot for your help!
 
Upvote 0
You can do this:

Code:
CheckBox5.Value = (CheckBox1.Value = True Or CheckBox2.Value = True)
CheckBox5.Enabled = Not (CheckBox1.Value = True Or CheckBox2.Value = True)
 
Upvote 0

Forum statistics

Threads
1,224,722
Messages
6,180,559
Members
452,987
Latest member
mrfitness_79

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