在Excel VBA中作为参数传递时,转移范围的类型是什么?

发布于 2025-01-30 17:07:32 字数 458 浏览 4 评论 0原文

我有一个用户定义的函数“ HP”,它使用VBA(而不是vb.net)在Excel中使用。它采用范围参数:

Function HP(data as Range)

它旨在为“垂直”组织的数据工作 - 通常是一列是包含多个观察值的串联。列中的每个单元格是一个观察结果

,因此该函数可与这样的范围(例如)工作:

=HP(D1:D100)

我需要对其进行调整以与有组织的数据“水平”(通常是一排)一起工作。

在我的电子表格中,我输入以下

=HP(Transpose(A1:CV1))

此返回#Value错误。在检查时,似乎存在类型错误:它不接受转置(A1:CV100)作为范围对象,

几年前,类似的技巧用于工作。现在没有。

有什么想法吗?

I have a User Defined Function 'HP' which I use in Excel using VBA (not VB.NET). It takes a Range parameter:

Function HP(data as Range)

It is designed to work for data that is organised 'vertically' - typically with one column being a series containing multiple observations. Each cell in the column is an observation

Thus, the function works with a range (for example) like this:

=HP(D1:D100)

I need to adapt it to function with data organised 'horizontally' - typically a single row.

In my spreadsheet, I enter the following

=HP(Transpose(A1:CV1))

This returns a #VALUE error. On examination, it seems that there is a type error: it does not accept TRANSPOSE(A1:CV100) as a Range object

A similar trick used to work, a couple of years ago. Now it doesn't.

Any thoughts?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文