question about excel formulas

Semidevil

Diamond Member
Apr 26, 2002
3,017
0
76
so I have some cells that will input data based on the value of another cell.

i.e, I wrote an If statement in my formula bar that says if A2 is yes, then B2 will say "N/A." ETC ETC.

I also have a 'clear all' macro that is suppose to clear all my data.

Is there a way to keep the formula permanantly there, even after the clear all button is pushed? I dont mind erasing the data, but I want to keep the formula always in the cell.

any ideas how to approach this?

p.s. I tried the protect contents. but when I do that, it wont run the clear all macro. gives me an error.


the only thing I can think of is to record a macro of me deleting manually....but is there a more effecient way?
 

mayest

Senior member
Jun 30, 2006
306
0
0
I'm not sure that I'm following this, but it seems like you want to delete the data and then have it appear that the formula is gone as well (but its still there)? If so, you could just do something like =If(A2="Yes", NA(), ""). That would put an empty text string in the formula result and the cell would appear to be empty. I'm not sure what the macro has to do with it, but obviously it shouldn't be deleting the formula.