Why Doesn't it Clear??

R

Roger

Hello Everyone,

I thought the below macro would look on my noted page and take all the cells
in the range with “No†and clear them, but it doesn’t work.

Any thoughts?

Thanks - Roger

Sub NoNo()

For Each c In Worksheets("Intro Page").Range("B18:B65").Cells
If c.Value = "No" Then c.ClearContents = True
Next
End Sub
 
D

Dave Peterson

Maybe the value isn't "No". Could it be "nO" or "NO" or "no" or "No " or " No "
or....

You may want to record a macro when you select B18:B65 and
do an edit|replace
what: No
with: (leave blank)
replace all

You may it runs more quickly.
 
D

DanRoss

c.ClearContents is all you need. not c.ClearContents = True

For Each c In Worksheets("Intro Page").Range("B18:B65").Cells
If c.Value = "No" Then c.ClearContents
Next
 
D

Dave Peterson

Much better answer!
c.ClearContents is all you need. not c.ClearContents = True

For Each c In Worksheets("Intro Page").Range("B18:B65").Cells
If c.Value = "No" Then c.ClearContents
Next
 
R

Roger

sThanks so much to both of you Dan and Dave.

I couldn't get into my posts earlier and now I'm able to get in and view the
results. Great ideas from both of you and it now work great.

Thanks for your time and responses - Roger
 
Top