Solved

Identify rows that have generated errors through their calculations

Posted on 2003-12-04
2
222 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 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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio hangs on running project 6 84
Problems moving Excel files from local drive to server 4 72
Is online banking safe? 11 122
CSV file copy field 1 to field 2 2 62
This article will show, step by step, how to integrate R code into a R Sweave document
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 …

732 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