Address of first layer of precedent cells via VBA in Excel

后端 未结 2 1829
囚心锁ツ
囚心锁ツ 2020-12-04 00:18

On the debug toolbar, you can click a button that shows you directed arrows of cells that are directly called by the selected cell (I\'m calling these direct precedents the

相关标签:
2条回答
  • 2020-12-04 01:06

    It turns out there is a different property for ranges that tells you this, DirectPrecidents.

    I had thought that it would be a property of the precedents, not a separate property in and of itself.

    0 讨论(0)
  • 2020-12-04 01:14

    Alec,

    Thank you for closing out your own question. I am posting these comments as an answer rather than a comment given their length

    Excel is rather flakey when it comes to 3D functionality (across sheets). Both Precedents and DirectPrecedents work only on the local sheet

    To work with off-sheet Precedents and Dependents you will need to use the NavigateArrows Method, this is the VBA equivalent of tracing precedents and dependents via the audit toolbar.

    Bill Manville did the heavy lifting on this approach some time back, below are two links applying Bill's approach. The first provides Bill's function, the second link is from me, this article looks "backwards" to test if a certain number eventually links back to a specific sheet

    • Bill Manville's FindPrecedents function (written up at vbaexpress)
    • My article 'Using a recursive NavigateArrows Method to analyse all local and off sheet cell dependencies' at Ee
    0 讨论(0)
提交回复
热议问题