Excel: Check Sheet Dependencies within a Workbook?

Martin picture Martin · Feb 21, 2011 · Viewed 9.2k times · Source

I'm in the process of refactoring a huge workbook woth a lot of legacy parts, redundant computations, cross-dependencies etc.

Basically, I'm trying to remove unneeded sheets and implement some proper information flow within the workbook. Is there a good way to extract the dependencies between the sheets (with VBA)?

Thanks Martin

Answer

Charles Williams picture Charles Williams · Feb 21, 2011

You can use ShowPrecedents and NavigateArrow. here is some pseudocode

for each oCell in oSht containing a formula
ocell.showprecedents
do until nomoreprecedents
i=i+1
Set oPrec = oCell.NavigateArrow(True, 1, i)
If not oPrec.Parent Is oSht Then
' off-sheet precedent
endif
loop
next ocell