Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Macro Clear Cell Contents

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Macro Clear Cell Contents

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
--
HTH...

Jim Thomlinson


"Frank" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Macro Clear Cell Contents

Jim, Thank you, it works well.

"Jim Thomlinson" wrote:

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
--
HTH...

Jim Thomlinson


"Frank" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to clear range contents when cell contents are changed by us Steve E Excel Programming 12 February 22nd 07 09:09 PM
Clear Contents Macro WBTKbeezy Excel Programming 1 November 16th 06 10:50 PM
Need macro to clear contents steve_sr2[_2_] Excel Programming 4 February 28th 06 09:20 AM
VBA Macro to Clear Named Cell Contents [email protected] Excel Programming 3 January 3rd 06 08:42 PM
MACRO TO CLEAR CELL CONTENTS Jay Dean Excel Programming 2 October 11th 03 02:51 PM


All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"