View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Héctor Miguel Héctor Miguel is offline
external usenet poster
 
Posts: 434
Default Sub to check and report any formula returned error (eg: #REF!)

hi, Max !

I need a sub to run a quick check through a list of sheets (using their codenames) filled with a ton of formulae
and pop up an all clear msg if there are no errors (eg: #REF!) returned in any formula cell.
If there are errors, msg will list the affected codenames. Thanks


try with someting like...

Sub ChkErr()
Dim ws As Worksheet, Msg As String
For Each ws In Worksheets
On Error Resume Next
Msg = Msg & vbCr & ws.CodeName & ": " & _
ws.Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Address(0, 0)
Next
MsgBox "Errors found in..." & IIf(Msg < "", Msg, vbCr & "All Clear !!!")
End Sub

hth,
hector.