View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
moondark[_4_] moondark[_4_] is offline
external usenet poster
 
Posts: 1
Default Delete cell contents that contain numbers and not formulae ...


Code
-------------------
For Each cell In Range("A1:A5") 'Range is to be set manually or just "ActiveSheet.Cells" for the whole sheet
If Not (cell.HasFormula Or (cell.Value < 0 And cell.Value 9)) Then cell.ClearContents
Next cel
-------------------


It's simple but works :)

Simon
------------------------
Just mentioned that you didn't want to delete text. Have to edit th
code then. So don't use it in the meantime.
------------------------
Ok, the If-Statement had to be edited:

Code
-------------------
If (cell.HasFormula = False) And (IsNumeric(cell.Value)) Then cell.ClearContent
-------------------


;

--
moondar
-----------------------------------------------------------------------
moondark's Profile: http://www.excelforum.com/member.php...fo&userid=2739
View this thread: http://www.excelforum.com/showthread.php?threadid=46987