ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Retaining formula after deleting contents. (https://www.excelbanter.com/excel-discussion-misc-queries/171944-retaining-formula-after-deleting-contents.html)

SiH23

Retaining formula after deleting contents.
 
Hi,

Is is possible to delete the contents of a cell but to retain the formula
assigned to it.

I am trying to duplicate a worksheet and have copied the existing one, but
when I try to delete the contents the formulas are also deleted.

Many thanks for your help in advance.

Simon.

Gary''s Student

Retaining formula after deleting contents.
 
Run this short macro on the copied worksheet:

Sub keepformulas()
For Each r In ActiveSheet.UsedRange
If r.HasFormula Then
Else
r.Clear
End If
Next
End Sub

--
Gary''s Student - gsnu200764


"SiH23" wrote:

Hi,

Is is possible to delete the contents of a cell but to retain the formula
assigned to it.

I am trying to duplicate a worksheet and have copied the existing one, but
when I try to delete the contents the formulas are also deleted.

Many thanks for your help in advance.

Simon.


CLR

Retaining formula after deleting contents.
 
Deleting the values in the cells that cause the formula to return a result
other than blank, would result in the formula being in the cell, but
invisible, or zero, or whatever default value the formula concluded.

Vaya con Dios,
Chuck, CABGx3



"SiH23" wrote:

Hi,

Is is possible to delete the contents of a cell but to retain the formula
assigned to it.

I am trying to duplicate a worksheet and have copied the existing one, but
when I try to delete the contents the formulas are also deleted.

Many thanks for your help in advance.

Simon.


Gord Dibben

Retaining formula after deleting contents.
 
F5SpecialConstantsOK

EditDelete


Gord Dibben MS Excel MVP

On Mon, 7 Jan 2008 06:24:03 -0800, SiH23
wrote:

Hi,

Is is possible to delete the contents of a cell but to retain the formula
assigned to it.

I am trying to duplicate a worksheet and have copied the existing one, but
when I try to delete the contents the formulas are also deleted.

Many thanks for your help in advance.

Simon.




All times are GMT +1. The time now is 02:36 AM.

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