ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clear contents/keep formula (https://www.excelbanter.com/excel-programming/330655-clear-contents-keep-formula.html)

Flopp2

Clear contents/keep formula
 
How do you clear the contents of a cell but keep the formula? Also, how do I
program that if answer is 0 then leave cell blank instead of putting in the
zeros? Thank you

Tom Ogilvy

Clear contents/keep formula
 
You don't. The formula produces a result and that is what is displayed.
You could possibly change all the font colors to match the background color
or you could adjust all your formulas to do something like this

=if(A1<"",currentformula,"")

then if you cleared A1, all cells would look blank.

You could use a similar construct to appear blank if the formula returns a
zero.

=if(A1<"",if(currentformula=0,"",currentformula), "")


--
Regards,
Tom Ogilvy

"Flopp2" wrote in message
...
How do you clear the contents of a cell but keep the formula? Also, how

do I
program that if answer is 0 then leave cell blank instead of putting in

the
zeros? Thank you




Tom Ogilvy

Clear contents/keep formula
 
for the zero appears blank question, a better approach might be to do
Tools=Options=View and uncheck Zero Values.

--
Regards,
Tom Ogilvy


"Flopp2" wrote in message
...
How do you clear the contents of a cell but keep the formula? Also, how

do I
program that if answer is 0 then leave cell blank instead of putting in

the
zeros? Thank you




lschuh

Clear contents/keep formula
 
Maybe I have been asking the wrong question as you have offered me plenty of
help. "vba code doesn't work". What this guy is asking is kind of what I
want to do. I have cell references to another worksheet which if there is no
data then it displays 0. Your idea of changing the background color to match
fonts or visa versa might be the ticket. You see the length of my worksheet
keeps changing depending of how much data is being transferred in and all I
basically wanted to do is clean up the cosmetics of the worksheet. Is this
your suggestion for me?

"Tom Ogilvy" wrote:

You don't. The formula produces a result and that is what is displayed.
You could possibly change all the font colors to match the background color
or you could adjust all your formulas to do something like this

=if(A1<"",currentformula,"")

then if you cleared A1, all cells would look blank.

You could use a similar construct to appear blank if the formula returns a
zero.

=if(A1<"",if(currentformula=0,"",currentformula), "")


--
Regards,
Tom Ogilvy

"Flopp2" wrote in message
...
How do you clear the contents of a cell but keep the formula? Also, how

do I
program that if answer is 0 then leave cell blank instead of putting in

the
zeros? Thank you






All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com