clear the values, but not the formulas in a range

  • Thread starter Thread starter aidy
  • Start date Start date
A

aidy

I'm trying to clear the values, but not the formulas in this range?

Range("E3:F3, E5:F5").ClearContents

Is it possible?

Cheers

Aidy
 
Hi

You can use

On Error Resume Next
Range("E3:F3, E5:F5").SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0
 
If a formula evaluates to a value, you can't clear the value without
eliminating the formula. You can hide the value by making the font color
match the background, if that is what you want to do. Or just hide the cells.
 
Just realized you probably have a mix (unknown to you) of cells with formulas
and values. Try Range("E3:F3,
E5:F5").SpecialCells(xlCellTypeConstants).ClearContents.
 
Back
Top