What function can I use in Excel VBA to slice an array?
相关问题
- How to get the maximum of more than 2 numbers in V
- Faster loop: foreach vs some (performance of jsper
- Convert Array to custom object list c#
- Excel sunburst chart: Some labels missing
- pick a random item from a javascript array
相关文章
- Numpy matrix of coordinates
- PHP: Can an array have an array as a key in a key-
- Get column data by Column name and sheet name
- Accessing an array element when returning from a f
- How can I convert a PHP function's parameter l
- How to make a custom list deserializer in Gson?
- programmatically excel cells to be auto fit width
- Recursively replace keys in an array
Here is one other way.
This is not multidimensional but would work single row and single column.
f and t parameters are Zero based.
If you specify a zero value for row or column, then you'll get the entire column or row that is specified.
Example:
This will give you the entire 3rd column.
If you specify both row and column as non-zero, then you'll get only the specific element. There is no easy way to get a smaller slice than a complete row or column.
Limitation: There is a limit to the array size that
WorksheetFunction.Index
can handle if you're using a newer version of Excel. Ifarray
has more than 65,536 rows or 65,536 columns, then it throws a "Type mismatch" error. If this is an issue for you, then see this more complicated answer which is not subject to the same limitation.Here's the function I wrote to do all my 1D and 2D slicing: