在Excel VBA中作为参数传递时,转移范围的类型是什么?
我有一个用户定义的函数“ 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论