Placing values in a cell using checkbox macro

kwroche

New Member
Joined
Jun 18, 2008
Messages
16
I have a checkbox macro that calls a macro when its on and calls a different macro when its off. The macro is as follows:

Sub OxygenCheckBox()
Dim cb As Excel.CheckBox


Set cb = Excel.ActiveSheet.CheckBoxes(Application.Caller)
If cb.Value = xlOn Then
Call YesOxygen
Else
Call Oxygen
End If

in addition to calling these macros, I want the checkbox to place "0" in a range of cells when checked (E280:E285), and when unchecked I want cells E280:E285 to display its normal formulas. Is there anyway to do this? Thank you for any help.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
yes i can, I just don't know how I would do the code for that, I've tried a number of things but it won't work. Sorry, I should of clarified it more clearly what I need. I need the code for a macro to do what I talked about earlier.
 
Upvote 0
Putting zero in the cells is easy:

Range("E280:E285").Value = 0

The formula would probably also be easy if I knew what it was.

An alternative is to change your formulas in E280:E285 so that they return 0 if the CheckBox's LinkedCell contains TRUE.
 
Upvote 0
ooo, thats a good idea.

Ok, tell me what to fix with this then...
=if(check box 62=true,0,"formula")
this doesn't work as I am unsure of how to check to see whether a check box value is on or not in a cell formula. Could you help me out on that one?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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