E
ExcelMonkey
Thank-you. However I am not sure how to use this? It does not seem a
though this returns a boolean. When I try to call it below I get a
error stmt saying "Argument not optional" inplying that I have not pu
in an argument. Yet you only have one argument. What am I doin
wrong????
Sub Thing()
Dim Cell As Range
Dim HasIntDep As Boolean
Dim ExtIntDep As Boolean
Dim CountDep As Integer
Dim X As Double
Set Cell = Range("StartCell")
ExtIntDep = ExternalDependents(Cell)
End Sub
Function ExternalDependents(SrcRange As Range) As Collection
Dim DstRange As Range, Externals As New Collection, n&
If TypeOf Application.Caller Is Range Then GoTo theExit
If SrcRange.Cells.Count > 1 Then GoTo theExit
On Error Resume Next
Application.ScreenUpdating = False
With SrcRange
If Not .DirectDependents Is Nothing Then
.ShowDependents True
.ShowDependents False
'Escape if there are too many...
Set DstRange = .NavigateArrow(False, 1, 1025)
If Err = 0 Then
Externals.Add CVErr(xlErrValue)
GoTo theExit
End If
n = 1
Do
Set DstRange = .NavigateArrow(False, 1, n)
If Err <> 0 Then Exit Do
Externals.Add DstRange
n = n + 1
Loop While n <= 1024
End If
End With
Stop
theExit:
Application.ScreenUpdating = True
Set ExternalDependents = Externals
End Functio
though this returns a boolean. When I try to call it below I get a
error stmt saying "Argument not optional" inplying that I have not pu
in an argument. Yet you only have one argument. What am I doin
wrong????
Sub Thing()
Dim Cell As Range
Dim HasIntDep As Boolean
Dim ExtIntDep As Boolean
Dim CountDep As Integer
Dim X As Double
Set Cell = Range("StartCell")
ExtIntDep = ExternalDependents(Cell)
End Sub
Function ExternalDependents(SrcRange As Range) As Collection
Dim DstRange As Range, Externals As New Collection, n&
If TypeOf Application.Caller Is Range Then GoTo theExit
If SrcRange.Cells.Count > 1 Then GoTo theExit
On Error Resume Next
Application.ScreenUpdating = False
With SrcRange
If Not .DirectDependents Is Nothing Then
.ShowDependents True
.ShowDependents False
'Escape if there are too many...
Set DstRange = .NavigateArrow(False, 1, 1025)
If Err = 0 Then
Externals.Add CVErr(xlErrValue)
GoTo theExit
End If
n = 1
Do
Set DstRange = .NavigateArrow(False, 1, n)
If Err <> 0 Then Exit Do
Externals.Add DstRange
n = n + 1
Loop While n <= 1024
End If
End With
Stop
theExit:
Application.ScreenUpdating = True
Set ExternalDependents = Externals
End Functio