DELETE AWAY #N/A

Status
Not open for further replies.

ru_1985

New Member
Joined
Oct 4, 2006
Messages
35
How can i also delete away the #N/A with this code??


Code:
Sub MyDeleteFormula() 

    Dim myRange As Range 
    Dim myRange1 As Range 
    Dim myCell As Range 
    
'   Set range to check 
    Set myRange = Range("C5:J35") 
    Set myRange1 = Range("M5:T35") 
    
    
    
'   Loop through each cell in range and delete contents if value is blank 
    For Each myCell In myRange 
        If myCell.Value = "" Or myCell.Value = 0 Then myCell.ClearContents 
    Next myCell 
    For Each myCell In myRange1 
        If myCell.Value = "" Or myCell.Value = 0 Then myCell.ClearContents 
    Next myCell 
        
End Sub 
 
Code:
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

patrickmuldoon99

Active Member
Joined
Jun 27, 2006
Messages
345
Have you tried:

Code:
If myCell.Value = "" Or myCell.Value = 0 Or myCell.Value = "#N/A" Then myCell.ClearContents

?
 

Krishnakumar

Well-known Member
Joined
Feb 28, 2003
Messages
2,615

ADVERTISEMENT

Hi,

Code:
With myRange
    .SpecialCells(xlCellTypeFormulas, 16).ClearContents
    .Replace What:="0", Replacement:="", LookAt:=xlWhole
End With

HTH
 

Stormseed

Banned
Joined
Sep 18, 2006
Messages
3,274

ADVERTISEMENT

will logic something like this work?

=IF(ISERROR( ),"", )

this one is the best thing to do....! :biggrin:
 
Status
Not open for further replies.

Forum statistics

Threads
1,136,708
Messages
5,677,317
Members
419,687
Latest member
ash59

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top