Inserting iserror into a range of cells

  • Thread starter Thread starter Shatin
  • Start date Start date
S

Shatin

Hello all,

Does anyone have a subroutine for inserting iserror into a range of cells
automatically? I need to do that for a large worksheet and if I have do that
manually I'll go nuts soon!
 
Shatin

Sub ErrorTrapAdd()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then
If Not cel.Formula Like "=IF(ISERROR*" Then
myStr = Right(cel.Formula, Len(cel.Formula) - 1)
cel.Value = "=IF(ISERROR(" & myStr & "),""""," & myStr & ")"
End If
End If
Next
End Sub

Gord Dibben Excel MVP
 
Back
Top