我知道这个错误会在论坛上弹出很多,但我见过的帖子都没有同样的问题。 尝试使用Application.Index函数切片2D数组时,出现编译错误。 我之前使用过这个函数来进行简单的索引,但是在切片网络上有很多例子。
以下是代码。 它总是突出显示“.index”,并给我编译错误。 我曾尝试将数组转换为double,integer和variant,但没有任何效果。 请帮忙。
Dim test_z(2, 2) As Double Dim new_z As Double 'fill the text_z array with values test_z(0,0) = 1 'etc.... new_z = Application.index(test_z, 1, 0)I know this error pops up a lot on the forum, but none of the posts I have seen have the same issue. I get a compile error when trying to use the Application.Index function to slice a 2D array. I have used the function before for simple indexing but there are multiple examples on the web of slicing being done.
Below is the code. It always highlights ".index" and gives me the compile error. I have tried casting the array as double, integer, and variant but nothing works. Please help.
Dim test_z(2, 2) As Double Dim new_z As Double 'fill the text_z array with values test_z(0,0) = 1 'etc.... new_z = Application.index(test_z, 1, 0)最满意答案
如果您传递0作为最后一个参数,则Index返回一个数组。 你不能把它分配给Double - 也许试试
Dim new_z As VariantIndex returns an array if you pass 0 as the last argument. You can't assign that to Double - maybe try
Dim new_z As Variant更多推荐
发布评论