Id'ing tabs that contain #REF!'s
Steve wrote...
....
a separate sheet that would show which sheets have #REF!'s., something like:
Sheet a! * *ok
Sheet b! * *Ref
Sheet c! * *Ref
Sheet d! * *ok
....
If you want to identify worksheets which have cells evaluating to
#REF!, then with the worksheet name in cell A3, you could use the
formula
=IF(COUNTIF(INDIRECT("'"&A3&"'!A:IV"),"=#REF!"),"R ef","ok")
Note that such formulas recalculate very slowly. Since you wouldn't
need to do this often, you may be better off using a macro to list the
worksheets with cells evaluating to #REF!. Something like
Sub foo()
Dim ws As Worksheet, wsc As Sheets, res As String
If ActiveWindow.SelectedSheets.Count 1 Then
Set wsc = ActiveWindow.SelectedSheets
Else
Set wsc = ActiveWindow.Parent.Worksheets
End If
On Error Resume Next
Debug.Print String$(40, "-")
For Each ws In wsc
Call ws.UsedRange _
.SpecialCells(xlCellTypeFormulas, xlErrors) _
.Find(what:="#REF!", LookIn:=xlValues)
If Err.Number = 0 Then
res = res & vbLf & ws.Name
Debug.Print ws.Name
Else
Err.Clear
End If
Next ws
On Error GoTo 0
Debug.Print String$(40, "-")
If res = "" Then res = "<none" Else res = Mid$(res, 2)
MsgBox Title:="Worksheets with #REF! errors", Prompt:=res,
Buttons:=vbOKOnly
End Sub
|