映射“名称”到一个范围

发布于 2024-08-06 16:01:30 字数 150 浏览 1 评论 0原文

我为列范围设置了一个“名称”,我想稍后引用它:

Dim r As Range
r = Application.Names("Changes").Something

我已经尝试了一堆“某事”,但无法得到正确的结果。谢谢。

I setup a "Name" to a column range, and I want to reference it later on:

Dim r As Range
r = Application.Names("Changes").Something

I've tried a bunch of "Something" but cannot get this right. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

想你只要分分秒秒 2024-08-13 16:01:30
dim r as Range
Set r = Range("Changes")

“Set”关键字非常重要。

这适用于任何尺寸范围,包括单个细胞。

然后您可以访问范围变量“r”的属性和方法。

dim r as Range
Set r = Range("Changes")

The 'Set' keyword is very important.

This will work for any size range, including a single cell.

Then you can access the properties and methods of your range variable 'r'.

記憶穿過時間隧道 2024-08-13 16:01:30

尝试:

Set r = Application.Names("Changes").RefersToRange

Try:

Set r = Application.Names("Changes").RefersToRange
£烟消云散 2024-08-13 16:01:30

RefersTo 或 RefersToRange 是否有效?

Do either RefersTo or RefersToRange work?

不回头走下去 2024-08-13 16:01:30

这有用吗?

Dim R As Range
Set R = ThisWorkbook.Names("Changes").RefersToRange

我认为只有当范围是 2 个或更多单元格时它才有效。如果是的话,你必须做其他事情……但不太记得了。

另一种方式如下。

Sheets("Name").Range("Changes")

does this work?

Dim R As Range
Set R = ThisWorkbook.Names("Changes").RefersToRange

I think it will only work if the range is 2 cells or more. If it is one you have to do something else...don't really remember though.

Another way is as follows.

Sheets("Name").Range("Changes")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文