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
 
Gord,

Are you Gord and not God? You sub is so useful. Thanks so much for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top