Sub OffSheetDependentCount()
'Add new sheet "Dependents" at start of workbook and formats the sheet
Application.DisplayAlerts = False
On Error Resume Next
Sheets("Dependents").Delete
Application.DisplayAlerts = True
On Error GoTo 0
Sheets.Add().Name = "Dependents"
ActiveSheet.Move Before:=ActiveWorkbook.Sheets(1)
ActiveWindow.DisplayGridlines = False
ActiveWindow.Zoom = 70
ActiveSheet.Cells(2, 2) = "Sheet Name"
ActiveSheet.Cells(2, 3) = "Number of off-sheet dependencies"
Columns("A:D").Select
Selection.ColumnWidth = 30
Range("B2:C2").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
With Selection.Font
.FontStyle = "Bold"
.ColorIndex = 2
End With
With Selection.Interior
.ColorIndex = 50
End With
Range("B2:C2").Select
Selection.Borders(xlLeft).LineStyle = xlContinuous
Selection.Borders(xlRight).LineStyle = xlContinuous
Selection.Borders(xlTop).LineStyle = xlContinuous
Selection.Borders(xlBottom).LineStyle = xlContinuous
Rows("2:2").EntireRow.AutoFit
'Cycle through sheets, rows and columns
Dim DependentCount As Long
For ws = 2 To ActiveWorkbook.Worksheets.Count
DependentCount = 0 'each worksheet starts with zero off-sheet dependents
For r = 1 To Worksheets(ws).UsedRange.Rows.Count
For c = 1 To Worksheets(ws).UsedRange.Columns.Count
Worksheets(ws).Activate
Cells(r, c).Select
Selection.ShowDependents
'Identifies if cell has at least one dependency on another sheet
Worksheets(ws).Cells(r, c).NavigateArrow TowardPrecedent:=False, ArrowNumber:=1, LinkNumber:=1
If ActiveCell.Worksheet.Name <> Worksheets(ws).Cells(r, c).Worksheet.Name Then
'If so, adds the count of one to total dependents on the worksheet
DependentCount = DependentCount + 1
End If
Next c
Next r
'Add # of Dependent cells on this sheet to your new "Dependents" sheet
Worksheets(ws).ClearArrows
Worksheets("Dependents").Cells(ws + 1, 2) = Worksheets(ws).Cells(1, 1).Worksheet.Name
Worksheets("Dependents").Cells(ws + 1, 3) = DependentCount
Next ws
Worksheets("Dependents").Activate
Cells(1, 1).Select
End Sub