Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Accessing Dependent and Precedent Information.

Accessing Dependent and Precedent Information

Written by Allen Wyatt (last updated December 5, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


David rightly notes that Excel provides auditing tools (Trace Dependents and Trace Precedents) that are a very helpful way of keeping track of what is happening in large worksheets. However, the actual interface just lists out the cells in a small area, and David cannot easily copy out this list of cells to analyze and manipulate it. When he uses Trace Dependents on an important cell in a large worksheet, the small dialog box can contain several hundred references. David wonders if there is a relatively easy way of getting this information into a more usable format, like a blank worksheet or another workbook.

There is obviously no way to do this with native Excel commands, but you can create a macro that will extract the information you desire. The following macro will list the dependent cells for whatever cell is selected when you run the macro:

Sub ListDependents()
    Dim rArea As Range
    Dim rCell As Range
    Dim sActiveCell As String
    Dim rDep As Range
    Dim lRow As Long

    On Error Resume Next
    Set rDep = ActiveCell.Dependents
    If rDep Is Nothing Then
        MsgBox ActiveCell.Address(False, False) & _
          " has no dependents"
        Exit Sub
    End If

    On Error GoTo 0
    sActiveCell = ActiveCell.Address(False, False)
    Worksheets.Add
    lRow = 1
    Cells(lRow, 1).Value = "Dependents for " & sActiveCell
    For Each rArea In rDep
        For Each rCell In rArea
            lRow = lRow + 1
            Cells(lRow, 1) = rCell.Address(False, False)
        Next
    Next
    Set rArea = Nothing
    Set rCell = Nothing
    Set rDep = Nothing
End Sub 

When the macro is first run, it checks to see if there are any dependents for the cell. If there aren't, then you are notified and the macro is exited. If there are dependents, then a new worksheet is added to the workbook and the dependents of the cell are added to the worksheet.

If you want the macro to instead list precedents, all you need to do is change the all instances of "Dependents" in the macro to "Precedents."

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3121) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Accessing Dependent and Precedent Information.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Moving Breaks Quickly

Breaks in a document can be easily moved from one place to another using familiar editing techniques. The trick is to ...

Discover More

Processing Information Pasted from a PDF File

When pasting information copied from a PDF file, you can end up with a paragraph for each line of the original document. ...

Discover More

Getting Bookmark Information in VBA

Bookmarks are a handy way to "mark" locations within a document. If you are creating a macro that processes the document ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Counting Precedents and Dependents

Do you need to know how many precedents or dependents there are on a worksheet? You could count them manually, or you ...

Discover More

Understanding Auditing

Excel provides some great tools that can help you see the relationships between the formulas in your worksheets. These ...

Discover More

Discovering Dependent Workbooks

When you starting linking information from one workbook to another, those workbooks become dependent on each other. ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.