Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 361
Default Clear Contents Of Cells Where Value = 0

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Clear Contents Of Cells Where Value = 0

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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Clear Contents Of Cells Where Value = 0

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


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 361
Default Clear Contents Of Cells Where Value = 0

Hi. Thank you for helping me.

I ran the code and it got hung up he

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
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
Code to clear contents jk Excel Worksheet Functions 3 September 4th 06 06:25 PM
Macro to clear contents of unprotected cells AND drop down boxes JB2010 Excel Discussion (Misc queries) 3 March 30th 06 10:13 AM
Clear clipboard contents Cordobes Excel Discussion (Misc queries) 4 November 22nd 05 02:41 AM
Clear Contents Macro SJC Excel Worksheet Functions 3 October 27th 05 07:26 PM
Clear Contents - NonBold cells Steve Excel Discussion (Misc queries) 3 February 13th 05 11:36 PM


All times are GMT +1. The time now is 04:09 AM.

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

About Us

"It's about Microsoft Excel"