PDA

View Full Version : [SOLVED:] Macro deletes the value in the cell but keep the formula



osevero
11-14-2013, 11:58 AM
Hi again,

I'll need a code for a macro that delete the value in cell D3 of Sheet1 and D5 of Sheet2. But the cell D5 of Sheet2 has a formula and I want the formula to be maintained. Does anyone know the code for this problem? :think:

Cheers

mancubus
11-14-2013, 01:22 PM
hi osevero.

if you want to maintain the formula/value in D5, why do you need a macro that cleares it?

osevero
11-14-2013, 02:08 PM
I don't want to keep the value, but the formula. The value is to be cleaned of the cell but keep the formula.
In fact there are many cells in multiple spreadsheet to clean and I want a macro to clean it all at once but keep cell formulas. The cell D3 and D5 are examples only. Just need to know the code to then apply the remaining cells :)

p45cal
11-14-2013, 02:28 PM
If a formula returns something in a cell youi can't clear its value leaving the formula not producing a result.
What you can do is either:
1. change the font colour of the result to match the backgrond of the cell inder certain conditions (conditional formatting), or
2. change the formula to return "" (a blank cell) if some condition is (not) met.