Macro Clear Cell Contents

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I am trying to write this into my current macro where I clear the cells that
don't contain the letters "RO" in the below range.

Range("B4:BQ20").Select

Any help is greatly appreciated. Thank you
 
One way...

Sub ClearStuff()
Dim rng As Range

For Each rng In Range("B4:BQ20")
If InStr(UCase(rng.Value), "RO") = 0 Then _
rng.ClearContents
Next rng
End Sub
 
Jim, Thank you, it works well.

Jim Thomlinson said:
One way...

Sub ClearStuff()
Dim rng As Range

For Each rng In Range("B4:BQ20")
If InStr(UCase(rng.Value), "RO") = 0 Then _
rng.ClearContents
Next rng
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top