View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Clear Contents Of Cell If Value = 0 or Error

you haven't declared c..........

dim c as Range

blah blah
For Each c In myRange
If c.Value = 0 Then
c.Value = ""
End If
Next

also, "Next" needs to be "Next c"
you might also need to change
c.Value = ""
to
c.clearcontents

hope this helps!
susan


On Jul 9, 10:56 am, carl wrote:
I posted last week on this problem I am trying to solve.

Sub stantiate()
Dim myRange As Range
Set myRange = Range("C10:d1000")
For Each c In myRange
If c.Value = 0 Then
c.Value = ""
End If
Next
End Sub

The code gets hung up at:

If c.Value = 0 Then

the cell value could be #N/A or some other
"errors".

Could this be the reason the code gets hung up ?

If so, is there a way to resolve the problem ?

Thank you in advance.