PC Review


Reply
Thread Tools Rate Thread

Clear Contents Of Cells Where Value = 0

 
 
=?Utf-8?B?Y2FybA==?=
Guest
Posts: n/a
 
      5th Jul 2007
My range is c10:d1000. The cells have a data link (DDE) in them. The value of
the cell can be 0 to 3000.

Could a macro clear the contents of cells were the value is 0 ?

Thank you in advance.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlrZSBI?=
Guest
Posts: n/a
 
      5th Jul 2007
yes it could.

Right click the sheet tab and paste this in

Sub stantiate()
Dim myRange As Range
Set myRange = Range("C10:d1000")
For Each c In myRange
If c.Value = 0 Then
c.Value = ""
End If
Next
End Sub


Mike

"carl" wrote:

> My range is c10:d1000. The cells have a data link (DDE) in them. The value of
> the cell can be 0 to 3000.
>
> Could a macro clear the contents of cells were the value is 0 ?
>
> Thank you in advance.

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      5th Jul 2007
Sub Clear_Cells_With_Zero()
findstring = "0"
Set B = Range("C:C").Find(What:=findstring, LookAt:=xlWhole)
While Not (B Is Nothing)
B.ClearContents
Set B = Range("C:C").Find(What:=findstring, LookAt:=xlWhole)
Wend
End Sub

Without using a macro you should be able to use Data>Filter>Autofilter on column
C to find cells with zero and clear contents.


Gord Dibben MS Excel MVP

On Thu, 5 Jul 2007 09:24:02 -0700, carl <(E-Mail Removed)> wrote:

>My range is c10:d1000. The cells have a data link (DDE) in them. The value of
>the cell can be 0 to 3000.
>
>Could a macro clear the contents of cells were the value is 0 ?
>
>Thank you in advance.


 
Reply With Quote
 
=?Utf-8?B?Y2FybA==?=
Guest
Posts: n/a
 
      6th Jul 2007
Hi. Thank you for helping me.

I ran the code and it got hung up here:

If c.Value = 0 Then

I should have mentioned that the cell value vould be #N/A or some other
"errors".

Could this be the reason the code gets hung up ?

If so, is there a way to resolve the problem ?

Thank you in advance.

"Mike H" wrote:

> yes it could.
>
> Right click the sheet tab and paste this in
>
> Sub stantiate()
> Dim myRange As Range
> Set myRange = Range("C10:d1000")
> For Each c In myRange
> If c.Value = 0 Then
> c.Value = ""
> End If
> Next
> End Sub
>
>
> Mike
>
> "carl" wrote:
>
> > My range is c10:d1000. The cells have a data link (DDE) in them. The value of
> > the cell can be 0 to 3000.
> >
> > Could a macro clear the contents of cells were the value is 0 ?
> >
> > Thank you in advance.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to clear contents of certain cells MrAcquire Microsoft Excel Misc 4 1st Nov 2010 09:04 PM
Clear Contents of Specific Cells in Last Row Steve Microsoft Excel Programming 2 16th Mar 2009 10:18 PM
Clear contents of cells if a condition is met bevchapman Microsoft Excel Worksheet Functions 2 16th Mar 2009 03:45 PM
clear contents cells of unprotected cells =?Utf-8?B?RWQ=?= Microsoft Excel Programming 6 12th Jan 2006 06:09 PM
Clear Contents - NonBold cells =?Utf-8?B?U3RldmU=?= Microsoft Excel Misc 3 13th Feb 2005 11:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:30 PM.