How can I save the formulas when running a macro? Need ASAP!!

M

MLP

I have a simple question...is there a way, via code, to only clear the
contents of a defined range of cells and allow the rest of the worksheet to
remain untouched? Seems simple, but I'm new to macros.
 
G

Gary''s Student

Here is an example of clearing a defined range:

Sub clear_part()
Dim r As Range
Set r = Range("A1:C5")
r.Clear
End Sub
 
G

Gary''s Student

If you need to keep formulae and clear only data:

Sub clear_part2()
Dim r As Range
Set r = Range("A1:C5").SpecialCells(xlCellTypeConstants)
r.Clear
End Sub
 
Top