Precedents Property

  • Thread starter Thread starter Derek
  • Start date Start date
D

Derek

I am trying to use the following code to get a list of all
the precedents of cell A1 on Sheet1:

Sub sbGetPrecedents()
Worksheets("Sheet1").Activate
MsgBox Range("A1").Precedents.Address
End Sub

It seems to create a list of all the precedents that are
on Sheet1, but it does not include the precedents that are
on other worksheets. Does anybody have a suggestion how I
can get these as well??? TIA
 
What you found is all you can get with the Precedents property.

The only way I know of finding off-sheet precedents (or dependents), is
to mimic the GUI capability. If you turn on the macro recorder and use
the Audting Toolbar to find and follow precedents, you will see how to
do it in code. This is one of those few instances when you must
activate the worksheets involved in the analysis.

--
Regards,

Tushar Mehta
MS MVP Excel 2000-2003
www.tushar-mehta.com
Excel, PowerPoint, and VBA tutorials and add-ins
Custom Productivity Solutions leveraging MS Office
 
Back
Top