Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to step through a range clearing the contents of
cells with number values, but not formulas. The following code doesn't work: If ActiveCell.Offset(currow - 1, 0).Type < xlCellTypeFormulas Then ActiveCell.Offset(currow - 1, 0).ClearContents End If Does the constant "xlcelltypeformulas" only work with the "specialCells" method? Is there another solution? DM |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the range you want to process is selected you could use the following
Sub ClearCells() Dim cell As Range For Each cell In Selection.SpecialCells(xlCellTypeConstants) cell.ClearContents Next cell End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dick,
Want to try this instead? Dim cell As Range For Each cell In Selection If Not cell.HasFormula Then cell.ClearContents End If Next cell -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Dick Minter" wrote in message ... I want to step through a range clearing the contents of cells with number values, but not formulas. The following code doesn't work: If ActiveCell.Offset(currow - 1, 0).Type < xlCellTypeFormulas Then ActiveCell.Offset(currow - 1, 0).ClearContents End If Does the constant "xlcelltypeformulas" only work with the "specialCells" method? Is there another solution? DM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to add time from multiple cells & date Cells & machine type c | Excel Worksheet Functions | |||
Logical Test with multiple cells | Excel Worksheet Functions | |||
Test for coloured cells? | Excel Discussion (Misc queries) | |||
Test for data in a range of cells | Excel Worksheet Functions | |||
an error.type test | Excel Worksheet Functions |