ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Eliminate Variant Array Elements (https://www.excelbanter.com/excel-programming/415377-eliminate-variant-array-elements.html)

David

Eliminate Variant Array Elements
 
Load array with worksheet range
Dim x as variant
x = Range(MyRange) ' n x 2 range
run process on array
How to eliminate elements (n, 1) and (n, 2)
to leave an (n-1) x (2) array?
I beleive that I cannot use ReDim on this type of array?
Thanks

Peter T

Eliminate Variant Array Elements
 
Your question is difficult to follow and ambiguous. From what I do follow,
you can use ReDim Preserve but only on the last dimension. Otherwise make a
new array sized to suit and copy what you want from the original into it
(means looping both dimensions)

Of course the simplest way would be to size and populate the array with what
you want in the first place. Append the range with .Resize() or possibly
..Offset().Resize() to suit

Regards,
Peter T


"David" wrote in message
...
Load array with worksheet range
Dim x as variant
x = Range(MyRange) ' n x 2 range
run process on array
How to eliminate elements (n, 1) and (n, 2)
to leave an (n-1) x (2) array?
I beleive that I cannot use ReDim on this type of array?
Thanks




Alan Beban[_2_]

Eliminate Variant Array Elements
 
David wrote:
Load array with worksheet range
Dim x as variant
x = Range(MyRange) ' n x 2 range
run process on array
How to eliminate elements (n, 1) and (n, 2)
to leave an (n-1) x (2) array?
I beleive that I cannot use ReDim on this type of array?
Thanks

If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook

x=SubArray(x,,,2)

Alan Beban


All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com