Selection.ClearContents for data only

R

Richard Lawson

Is it possible to clear the data without clearing the formulas?

I have an area of the sheet which is mostly data which needs to be cleared
before updating. A few cells have formulas attached.

Rich
 
J

JE McGimpsey

One way:

On Error Resume Next 'in case no constants
Selection.Cells.SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0
 
G

Guest

maybe something like this:

Sub Test()
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants).Clear
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top