Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to check and report any formula returned error (eg: #REF!)

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to check and report any formula returned error (eg: #REF!)

Positively brilliant, Hector. Thanks

How could the sub be tweaked a little to write the results of the checks
into a new sheet? (instead of the msgbox)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default Sub to check and report any formula returned error (eg: #REF!)

hi, Max !

How could the sub be tweaked a little to write the results of the checks into a new sheet? (instead of the msgbox)


this could be one way...

Sub ChkErr()
Dim ws As Worksheet, Tmp As String, Msg As String, n As Byte, TmpArray
For Each ws In Worksheets
On Error Resume Next
Tmp = ws.Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Address(0, 0)
If Err = 0 Then Msg = Msg & ";" & ws.CodeName & ": " & Tmp
Next
If Msg < "" Then
TmpArray = Split(Mid(Msg, 2), ";")
Application.ScreenUpdating = False
Worksheets.Add After:=Worksheets(Worksheets.Count)
[a1] = "Errors found on sheet(s)..."
For n = LBound(TmpArray) To UBound(TmpArray)
[a2].Offset(n).Value = TmpArray(n)
Next
Else
MsgBox "No errors found !"
End If
End Sub

hth,
hector.


  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to check and report any formula returned error (eg: #REF!)

Many thanks Hector, that does it well.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default Sub to check and report any formula returned error (eg: #REF!)

glad to be in help, Max

and thanks for your feed-back

regards,
hector.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
different values shown when #DIV/0! error is returned as result Danko Jotanovic Excel Discussion (Misc queries) 3 September 4th 09 09:18 AM
VALUE ERROR RETURNED FROM FORMULA mcoge Excel Worksheet Functions 4 March 7th 09 02:26 AM
error handling-need to get rid of a value returned as #N/A Gluefoot Excel Worksheet Functions 2 February 5th 08 10:40 PM
adding cells that contain formulas that have returned error messag Daniel R Excel Worksheet Functions 3 February 21st 05 07:14 PM
Error being returned Pat Excel Worksheet Functions 4 January 17th 05 04:33 PM


All times are GMT +1. The time now is 08:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"