PDA

View Full Version : delete numerical values only



lior03
01-14-2008, 03:44 AM
hello
i wanted a macro that would clear all numerical values from a selection,leaving the formulas and text intact.
On Error GoTo 0
Dim cell As Range
For Each cell In selection
If cell.HasFormula = False Then
cell.clear
End If
Next

and a second one:

On Error GoTo 0
Dim cell As Range
For Each cell In selection
ActiveCell.CurrentRegion.SpecialCells(xlCellTypeConstants).clear
Next


both macros clear text cells.how can i avoid it?
thanks

mikerickson
01-14-2008, 06:45 AM
ActiveCell.CurrentRegion.SpecialCells(xlCellTypeConstants, xlNumbers).clear