View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Trouble with Clear Contents Macro

On Wed, 17 Feb 2010 01:37:15 -0200, "Joe" wrote:

Hi Ron

If the error was the same, you could make the following changes:

Sub ClearContentsX()
On Error GoTo New_Search
Dim s As String
s = "x"
For Each r In Selection
If r.Value = s Then
r.ClearContents
End If
New_Search:
Next r
End Sub


Sorry for entering the discussion between both of you.

Bye.

Joe


Your solution should work if it is the case that all possible errors should be
ignored. I prefer to avoid error handlers if there are simpler ways of doing
things; that's why I would probably just use the Text property of the Range
object.
--ron