View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
mracquire mracquire is offline
external usenet poster
 
Posts: 3
Default Trouble with Clear Contents Macro

Excellent! Thanks, Ron. So much to learn. Thanks for your patience.

MrA

On Feb 16, 9:52*pm, Ron Rosenfeld wrote:
On Tue, 16 Feb 2010 19:10:54 -0800 (PST), mracquire
wrote:

I'm a VBA newbie so bear with me. *I originally excluded On Error
Resume Next and got the type mismatch error that you described. *But I
don't know what to include in my code instead to accomplish my
objective. *Your error checking suggestions are good, but I need
assistance in modifying my macro. *That's why I included a sample
worksheet and copy of my macro.


As I wrote, one way would be to use the Text property of the range object,
instead of the Value property. *Sorry I didn't give an example, but here it is:

====================================
Option Explicit
Sub ClearContentsX()
*Dim s As String
*Dim r As Range

s = "x"
For Each r In Selection
* * If r.Text = s Then
* * * * r.ClearContents
* * End If
Next r

End Sub
=========================
--ron