Debug Problem

J

John

Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn
 
N

Norman Jones

Hi John,

Try:

ActiveSheet.Cells.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContents
 
J

John

That works great, thanks. Now, could I change it so that it worked only
on area selected?

Thanks
John
 
N

Norman Jones

Hi John,

Try:


Selection.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContent
 
J

John

Changed to Selection.Cells.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContents

And it works perfectly though I have no idea HOW it works.

Thanks

John

Norman said:
Hi John,

Try:


Selection.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContent
 
N

Norman Jones

Hi John,

The code is the programmatic equivalent of the manual Steps:

Edit | Go To | Special | check Constants | uncheck all but the Numbers
sub-option | OK | hit the delete key

For further information see VBA help on the SpecialCells method.

I'm pleased you picked up the missing "s" !

---
Regards,
Norman



John said:
Changed to Selection.Cells.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContents

And it works perfectly though I have no idea HOW it works.

Thanks

John
 
Top