Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Box Excel VBA 1

Status
Not open for further replies.

tdonahue

Technical User
Feb 4, 2001
50
US
I am trying to solve a problem with my excel spreadsheet. I have two checkboxes. One Checkbox is in Cell C11 and the other checkbox is in D11. What I want to happen is:
if C11 is true and D11 is true I want the value in M11 to be linked to P11.

If C11 is true and D11 is False I want the Value in M11 to be linked to Z11.

If C11 is False and D11 is true I want the value in M11 to be linked to AK11.

If C11 is False and D11 is False I want the value in M11 to be linked to AV11.


I am still in the planning stage of this worksheet if there is a better approach please inform me. If it is posible to do what I ask this process must be repeated for fifty other rows.

tom
 
No VBA need.
In M11 enter this formula:
=IF(C11,IF(D11,P11,Z11),IF(D11,AK11,AV11))

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Sorry
This solution did not work. M11 is where the value has to be typed, so if I put the formula in M11 it will get deleted as soon as I type in a number.

If I put the formula in P11 I get a the number that is in M11. Also checking the boxes in C11 or D11 have no effect on a number showing up in P11, Z11, AK11 OR AU11.

Tom
 
psalm6229 what do you mean by "I want the Value in M11 to be linked to ....." ??
 
When I enter a value in M11 I want that value to appear in either P11, Z11, AK11 OR AU11 depending if box C11 is checked or not checked or if D11 is checked or not checked.

If C11 and D11 is checked I want the value in M11 to appear in P11.
If C11 is checked and D11 is not checked I want the value in M11 to appear in Z11.
If Cll in not checked and D11 is Checked I want the value in M11 to appear in AK11.
If C11 and D11 are not checked I want the value in M11 to appear in AU11.


Tom
 
So you have to deal with 4 formulas:
in P11: =IF(AND(C11,D11),M11,0)
in Z11: =IF(AND(C11,D11=False),M11,0)
and so on

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
PHV,

Originally I got an error " A value used in the formula is of the wrong data type" I added the logic operators and that got rid of the error. So the current formula is =IF(AND($C$11=TRUE,$D$11=TRUE),$M$11,0) I added the absolute references so I could copy the formula to the other three places and change the logic operators.


So it worked !!!!
I could not have got this without your help
Thanks

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top