As outlined you could rather than modify formulae apply Conditional Formats to the ranges which mask the appearance of the Errors
However, Conditional Formatting is super volatile so this may not be a wise choice pending volume of calcs / Calc Mode etc... and obviously underlying error values persist.
Adding handlers to the formulae manually can be time consuming but given use of XL2007+ you could add a quick IFERROR handler via code, in basic terms:
Sub Examples()
Dim rngC As Range, xlCalc As XlCalculation, strF As String
Const C_Handler = "IFERROR("
Const C_Default = False 'change to 0, False etc (ie default return where error occurs)
On Error GoTo Handler
With Application
xlCalc = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
.EnableEvents = False
End With
For Each rngC In Cells.SpecialCells(xlCellTypeFormulas)
With rngC
strF = Replace(.Formula, "=", "", 1, 1)
If InStr(1, strF, C_Handler, vbTextCompare) <> 1 Then
.FormulaLocal = "=" & C_Handler & strF & Application.International(xlColumnSeparator) & IIf(IsNumeric(C_Default), C_Default, """" & C_Default & """") & ")"
End If
End With
Next rngC
ExitPoint:
With Application
.Calculation = xlCalc
.ScreenUpdating = True
.EnableEvents = True
End With
Exit Sub
Handler:
MsgBox "Error Has Occurred" & vbLf & vbLf & _
"Error Number: " & Err.Number & vbLf & vbLf & _
"Error Desc.: " & Err.Description, _
vbCritical, _
"Fatal Error"
Resume ExitPoint
End Sub
the above adds an IFERROR handler to all functions on the active sheet if not already in existence - you can modify C_Default to whichever value you want to appear in cases of error
you will find countless (better) examples of this type of thing on line however
Again, not saying I would do this myself but it might prove to be the lesser of two evils if you have masses of formulae already configured.
edit: above revised at 12:47 UK time to cater for varying locales (reverted to FormulaLocal and use of International Column Delimiter)
Bookmarks