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)
Index
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.