Solved

NA Error

Posted on 2011-02-22
6
176 Views
Last Modified: 2012-05-11
Hi,

Im looking for a little sub i can run that will find any #N/A Errors and clear the contents of those cells

The tab is called "Output"

Thanks
Seamus
0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34950919
Do you just want #N/A errors, or all errors?
0
 

Author Comment

by:Seamus2626
ID: 34950930
All errors now you say it, thanks
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 250 total points
ID: 34950933
Try this then:
Sub ClearErrors()
   Dim rng As Range
   On Error Resume Next
   Set rng = Sheets("Output").UsedRange.SpecialCells(xlCellTypeFormulas, xlErrors)
   If Not rng Is Nothing Then rng.ClearContents
   Set rng = Sheets("Output").UsedRange.SpecialCells(xlCellTypeConstants, xlErrors)
   If Not rng Is Nothing Then rng.ClearContents

End Sub

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Assisted Solution

by:StephenJR
StephenJR earned 250 total points
ID: 34950934
Try this:
Sub x()

Dim r As Range

For Each r In Sheets("Output").UsedRange.SpecialCells(xlCellTypeFormulas, xlErrors)
    If r.Value = CVErr(xlErrNA) Then r.ClearContents
Next r

End Sub

Open in new window

0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34950940
OK, hadn't seen change to request.
0
 

Author Closing Comment

by:Seamus2626
ID: 34950946
Thanks guys,

Cheers,
Seamus
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question