Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cells without dependent cells

Status
Not open for further replies.

AELLC

Structural
Mar 4, 2011
1,339
Is there any way within Excel, that on a given worksheet, it will show which cells (that have a formula) have no dependent cells?
 
Replies continue below

Recommended for you

Not easily. You could wrap "Selection.DirectPrecedents.Select" with a loop and error trapping and run through every non-empty cell.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
I played around with Range.DirectDependents a bit - without success. But perhaps I was trying to be too clever with it.
 
This seems to work, subject to the published limitations of Range.ActiveDependents

Note also that if it is used ON THE SHEET then supplying a range as the argument CREATES a dependent cell or cells.


Code:
Public Function DependOnMe(Target As Range)
Dim TestCell As Range
Dim DependCount As Integer
On Error GoTo ErrorHandle
For Each TestCell In Target
If Not IsEmpty(TestCell.Address) Then
DependCount = TestCell.DirectDependents.Count
Debug.Print TestCell.Address & " has " & DependCount & " dependent cells."
End If
Next
End
ErrorHandle:
If Err.Number = 1004 Then DependCount = 0
Debug.Print TestCell.Address & " has " & DependCount & " dependent cells."
Resume Next
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor