Retaining formula after deleting contents.

S

SiH23

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.
 
G

Gary''s Student

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
 
C

CLR

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
 
Top