LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Redimming 2D array to 1D while preserving the data?


I create arrays of data by declaring a variant data type and setting it
equal to sheet ranges. For later data crunching, I have several ranges that
I need to use with Application.Match to find certain values. However, my
method of copying a range into a variant (as an array) brings this data in
as a 2D array, even though it is only one column of data.

Other than looping the data into a new 1D array (at which point, I might as
well just populate that 1D array directly from the sheet itself), is there
any way to redim (preserve) my single-column, 2D array data into a 1D array
for use with the Application.Match function?

Or alternatively, is there syntax for the Application.Match function that
will allow me to test the match against a selected parameter of a 2D (or 3D)
array?

I've looked online and googled, but haven't found any solutions.
Thanks!!
Keith


Sample aircode:

Sub GrabMyData
Dim MyMatchRange as Variant
MyMatchRange = Sheet1.range("B1:B10000")

'possibly redim to 1D here-
'redim preserve (MyMatchRange(1 to 10000) but redim doesn't allow me to
change the number of dimensions :(
'from help: If you use the Preserve keyword, you can resize only the last
array dimension and you can't change the number of dimensions at all
'attempts to redim to 1D without the preserve keyword appear to erase all
data in the array

'...lots of intermediate code...

Application.match (SampleID,MyMatchRange,False)
'or Application.match (SampleID,MyMatchRange(?,1),False), or some way to
process within a 2D array?

End sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redimming (preserve) a 3D array ker_01 Excel Programming 3 July 23rd 08 08:26 PM
Redimming an array dynamically assigned from range (how to redim first dimension of a 2-D array? /or/ reverse the original array order) Keith R[_2_] Excel Programming 3 November 13th 07 04:08 PM
Automatically preserving historical data ruleb Excel Discussion (Misc queries) 1 October 19th 05 12:27 AM
Preserving data formatting when using VLOOKUP shashak[_4_] Excel Programming 0 November 10th 04 04:59 PM
Preserving data formatting when using VLOOKUP shashak[_2_] Excel Programming 2 November 10th 04 04:29 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"