Error handling is very important task in excel reporting. It is extensively used in excel dashboard designing projects. There are several situation in reports where cell formula returns error value. It seems very bad to represent error values in dashboards. Thus, to overcome such a scenario where formula error occurs, we use iferror function in excel to assign some values which will be visible instead of error values in formulate cell.

To apply iferror function in multiple formulated cells in excel is a quite hectic task. It consumes lot of hours to apply iferror function on thousand of cells. But, by using below code this task can be finish in only couple of minutes.

Here is the code which will help you to apply iferror function on selected ranges.

Sub Apply_IFERROR_On_Selection()
'
' Author: Dreams24

' Written for VBA Tricks and tips blog
https://www.vbatricksntips.com

Dim myCell As Range

    For Each myCell In Selection.Cells

        If myCell.HasFormula And Not myCell.HasArray Then
            myCell.Formula = "=IFERROR(" & Right(myCell.Formula, Len(myCell.Formula) _ 1) & ",0)"
        End If
    Next

MsgBox "Task Finished. check your cells to validate formula..", vbInformation, Title:="Iferror Function"


End Sub