Solved

Identify rows that have generated errors through their calculations

Posted on 2003-12-04
2
217 Views
Last Modified: 2010-04-17


I have columns B through IV, rows 4 -45

all of the results for these fields are generated through calculations.  Some experience errors and result in #Value! or #DIV/0!  I don't want to change the numbers being generated and know why those errors occur.  But I would like to run a macro that woudl go through all the rows and evrytime it runs into one that generated an error change it to blank, without it removing the calculation that still sits in the cell - is this possible?
0
Comment
Question by:Mosquitoe
2 Comments
 
LVL 11

Expert Comment

by:KurtVon
ID: 9877832
I'm assuming you are using Excel.

If so, just change the formulas to use error checking:

=if(ISERR(originalformula), "", originalformula)

I suppose you could write a macro to change that.  I know of no other way to "blank" a cell and leave the formula intact at the same time.

Hoep this helps.
0
 
LVL 50

Accepted Solution

by:
Dave Brett earned 50 total points
ID: 9879968
Hi Mosquitoe,

If you run this maco it will convert all error cells in the activesheet to blanks without removing the formula

I suggest saving yur work before running this

Cheers

Dave

Sub MakeErroBlank()
Dim myrange    As Range
Dim cel        As Range
Dim cf As String
    On Error Resume Next
    Set myrange = ActiveSheet.Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
    On Error GoTo 0
    If myrange Is Nothing Then Exit Sub
    For Each cel In myrange
        cf = Right(cel.Formula, Len(cel.Formula) - 1)
        cel.FormulaR1C1 = "=IF(ISERROR(" & cf & "),""""," & cf & ")"
    Next
End Sub

Cheers

Dave
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
This is an explanation of a simple data model to help parse a JSON feed
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now