Solved

NA Error

Posted on 2011-02-22
6
172 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
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

810 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