Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Clearing content from a cell (or a group) but retain its formula
A cell contains a formula that produces a text when a condition is met (i.e.
produces "Played" if another cell contains a "yes"). How do I clear the content of a cell (or group of cells) that contains a formula WITHOUT destroying (NOT removing) the formula of the cell? A previous recommendation was to install the following macro: Sub ClearAllSaveFormulas() Dim cell As Range For Each cell In Selection With cell If Not .HasFormula Then .ClearContents End If End With Next End Sub However, if the cell contains a formula, the above macro will not clear the content of the cell. In advance, thank you for your time and help Dirk |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Clearing content from a cell (or a group) but retain its formula
Let me clarify further.
In A1 you have yes In C1 your formula is =IF(A1="yes","played") returns played Clear contents from A1 and C1 will display FALSE If you don't want FALSE you must change your formula in C1 =IF(A1="yes","played","") Gord On Tue, 19 Jan 2010 14:12:19 -0800, Gord Dibben <gorddibbATshawDOTca wrote: Works for me. Same as G5SpecialConstantsOKDelete. What "contents" do not get cleared? The cells with formulas may return errors or true or false. Do you wish to see nothing in the cells with formulas after clearing contents from precedent cells? You must trap for that in your formulas. Post some examples of your formulas. Gord Dibben MS Excel MVP On Tue, 19 Jan 2010 13:59:01 -0800, Dr. Dirk <Dr. wrote: A cell contains a formula that produces a text when a condition is met (i.e. produces "Played" if another cell contains a "yes"). How do I clear the content of a cell (or group of cells) that contains a formula WITHOUT destroying (NOT removing) the formula of the cell? A previous recommendation was to install the following macro: Sub ClearAllSaveFormulas() Dim cell As Range For Each cell In Selection With cell If Not .HasFormula Then .ClearContents End If End With Next End Sub However, if the cell contains a formula, the above macro will not clear the content of the cell. In advance, thank you for your time and help Dirk |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel: remove cell content but retain formula | Excel Discussion (Misc queries) | |||
How to delete/change the formula of a cell and yet retain its cont | Excel Worksheet Functions | |||
i have a check box that keeps clearing out my cells content | Excel Worksheet Functions | |||
clearing a cell and keeping the formula | New Users to Excel | |||
Can I retain a formula in the cell pasted to? | Excel Worksheet Functions |