The code below returns only ONE dependent from another sheet (even though there are multiple dependents on other sheets), and returns rngPrecedent's address (the cell we're investigating) multiple times.
I simplified this post from another one as I narrowed down the issue to be the specific line in red
I simplified this post from another one as I narrowed down the issue to be the specific line in red
Rich (BB code):
Sub FindDependents(ByVal rngPrecedent As range)
Dim dependentCell As range
Dim arrowNumber As Integer
'We'll be checking for errors as we go
On Error Resume Next
'Show the dependency arrows
rngPrecedent.parent.ClearArrows
rngPrecedent.ShowDependents
arrowNumber = 1
'We'll break out of this loop when no more dependencies are found.
Do
Set dependentCell = rngPrecedent.NavigateArrow(False, arrowNumber, 1)
If Err.Number <> 0 Then
GoTo NoMoreArrows
Else
keyStr = dependentCell.parent.name & "!" & dependentCell.Address
arrowNumber = arrowNumber + 1
End If
Loop While not dependentCell is nothing
NoMoreArrows:
Exit Sub
End Sub
Last edited by a moderator: