Excel中通过VBA的第一层先例单元格的地址 [英] Address of first layer of precedent cells via VBA in Excel

查看:166
本文介绍了Excel中通过VBA的第一层先例单元格的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试工具栏上,您可以单击一个按钮,显示由所选单元格直接调用的单元格的定向箭头(我将这些直接命令称为第一层)。但是,当您在单元格上使用 Precedants 属性时,会返回单元格依赖的工作表上的所有单元格。

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 'first layer'). However, when you use the Precedents property on a cell, it returns all of the cells on the sheet that the cell is dependent upon.

例如,我有单元格 DT836 ,其公式如下:

For example, I have cell DT836 with the formula:

=DP836+DR836+DS836

跟踪先例调试工具栏显示一个漂亮的蓝色箭头将这三个单元格连接到单元格 DT836

"Trace Precedents" Debug toolbar shows a nice blue arrow connecting those three cells to cell DT836.

范围(DT836)。 包含一个70,000多个单元格范围(据我所知),没有办法区分依赖者与其先例之间的距离。

Range("DT836").Precedents contains a 70,000+ cell range with (as far as I can tell) no way to distinguish between how distant a dependent is from its precedent.

有没有办法使用VBA来辨别这个问题?

Is there a way to discern this using VBA?

推荐答案

事实证明,有一个不同的属性可以告诉你, DirectPrecidents

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.

这篇关于Excel中通过VBA的第一层先例单元格的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆