Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Identify rows that have generated errors through their calculations

Posted on 2003-12-04
2
Medium Priority
?
226 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
[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 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 150 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Loops Section Overview

610 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