<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Arrays in Arrays</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: John Tolle</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-54074</link>
		<dc:creator>John Tolle</dc:creator>
		<pubDate>Sat, 13 Nov 2010 22:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-54074</guid>
		<description>&lt;p&gt;If you have an 1-D array of 1-D arrays (all the same non-zero length of course) that you need to get into a 2-D array, you can do it without looping. Excel will coerce it if you return it from a UDF. You can also use Application.Index(arr, 0, 0) when you&#039;re not returning from a UDF. See this for examples:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/questions/3992717/how-can-i-redim-preserve-a-2d-array-in-excel-2007-vba-so-that-i-can-add-rows-n/3993119#3993119&quot; rel=&quot;nofollow&quot;&gt;http://stackoverflow.com/questions/3992717/how-can-i-redim-preserve-a-2d-array-in-excel-2007-vba-so-that-i-can-add-rows-n/3993119#3993119&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If you have an 1-D array of 1-D arrays (all the same non-zero length of course) that you need to get into a 2-D array, you can do it without looping. Excel will coerce it if you return it from a UDF. You can also use Application.Index(arr, 0, 0) when you&#8217;re not returning from a UDF. See this for examples:</p>
<p><a href="http://stackoverflow.com/questions/3992717/how-can-i-redim-preserve-a-2d-array-in-excel-2007-vba-so-that-i-can-add-rows-n/3993119#3993119" rel="nofollow">http://stackoverflow.com/questions/3992717/how-can-i-redim-preserve-a-2d-array-in-excel-2007-vba-so-that-i-can-add-rows-n/3993119#3993119</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Phillips</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-54046</link>
		<dc:creator>Bob Phillips</dc:creator>
		<pubDate>Sat, 13 Nov 2010 01:44:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-54046</guid>
		<description>&lt;p&gt;You could try something like&lt;/p&gt;
&lt;p&gt;Dim vaTest As Variant&lt;br&gt;
Dim vaTemp As Variant&lt;br&gt;
Dim i As Long&lt;/p&gt;
&lt;p&gt;    vaTest = Array(Array(1, 2, 3), Array(4, 5, 6))&lt;br&gt;
    For i = LBound(vaTest) To UBound(vaTest)&lt;/p&gt;
&lt;p&gt;        vaTemp = Application.Index(vaTest, i - LBound(vaTest) + 1, 0)&lt;br&gt;
        Cells(1, i - LBound(vaTest) + 1).Resize(UBound(vaTemp) - LBound(vaTemp) + 1).Value = Application.Transpose(vaTemp)&lt;br&gt;
    Next i&lt;/p&gt;
&lt;p&gt;although I wouldn&#039;t bank on it being faster than Dick&#039;s suggestion.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You could try something like</p>
<p>Dim vaTest As Variant<br />
Dim vaTemp As Variant<br />
Dim i As Long</p>
<p>    vaTest = Array(Array(1, 2, 3), Array(4, 5, 6))<br />
    For i = LBound(vaTest) To UBound(vaTest)</p>
<p>        vaTemp = Application.Index(vaTest, i &#8211; LBound(vaTest) + 1, 0)<br />
        Cells(1, i &#8211; LBound(vaTest) + 1).Resize(UBound(vaTemp) &#8211; LBound(vaTemp) + 1).Value = Application.Transpose(vaTemp)<br />
    Next i</p>
<p>although I wouldn&#8217;t bank on it being faster than Dick&#8217;s suggestion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-54025</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Fri, 12 Nov 2010 14:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-54025</guid>
		<description>&lt;p&gt;Victor:  You can&#039;t.  Value can take one two-dimensional array, but not an array of arrays.  If you had to write a bunch of array within arrays, it might be quicker to combine all the arrays into one, then right that one.  It&#039;s still looping, but only one cell-write call.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Victor:  You can&#8217;t.  Value can take one two-dimensional array, but not an array of arrays.  If you had to write a bunch of array within arrays, it might be quicker to combine all the arrays into one, then right that one.  It&#8217;s still looping, but only one cell-write call.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-53971</link>
		<dc:creator>Victor</dc:creator>
		<pubDate>Thu, 11 Nov 2010 04:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-53971</guid>
		<description>&lt;p&gt;Excellent info, Dick.&lt;br&gt;
But how do you output the entire array of arrays to a range, without looping? (supposedly I manipulated the data or loaded the array from some other source)&lt;/p&gt;
&lt;p&gt;Typically, you&#039;d go something like:&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;Sheet2.Range(&lt;span class=&quot;st0&quot;&gt;&quot;A1:D4&quot;&lt;/span&gt;) = vaRangeArr&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;But this outputs nothing. However, I can output one line at a time like so:&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;Sheet2.Range(&lt;span class=&quot;st0&quot;&gt;&quot;A1:A4&quot;&lt;/span&gt;) = vaRangeArr(1)&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Thanks in advance,&lt;br&gt;
Victor&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Excellent info, Dick.<br />
But how do you output the entire array of arrays to a range, without looping? (supposedly I manipulated the data or loaded the array from some other source)</p>
<p>Typically, you&#8217;d go something like:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">Sheet2.Range(<span class="st0">&#8220;A1:D4&#8243;</span>) = vaRangeArr</div>
</div>
<p>But this outputs nothing. However, I can output one line at a time like so:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">Sheet2.Range(<span class="st0">&#8220;A1:A4&#8243;</span>) = vaRangeArr(1)</div>
</div>
<p>Thanks in advance,<br />
Victor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-48925</link>
		<dc:creator>Ross</dc:creator>
		<pubDate>Fri, 13 Aug 2010 21:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-48925</guid>
		<description>&lt;p&gt;Hey Dick, thanks for all the helpful background info, I&#039;ll be picking it to pieces as I usefully extract it into my program.  I do have the ranges (r1,r2,r3,r4) defined dynamically (only the number of rows will change), I neglected to copy that code over before.  And, I&#039;m becoming a fan of the Hungarian notation now too.&lt;/p&gt;
&lt;p&gt;However, I have given up on the Array of Arrays or trying to over reach my current understanding level of the Cell/Row as an Object of the Range Object (for an implicit array, if you will), and just looped through the cells in each range.  It actually gives a nice effect when I turn ScreenUpdating on (=True) to let the user literally see the Macro work for them.  Thankfully my ranges aren&#039;t too ridiculously large.&lt;/p&gt;
&lt;p&gt;Also, thanks for the LBound &amp; UBound explanation, MS does an atrocious job at explaining Objects/Methods/Properties and their Examples are foolishly worse.  So you help clarified that for me.&lt;/p&gt;
&lt;p&gt;Onto the next task... till next time, thanks!&lt;br&gt;
Ross&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey Dick, thanks for all the helpful background info, I&#8217;ll be picking it to pieces as I usefully extract it into my program.  I do have the ranges (r1,r2,r3,r4) defined dynamically (only the number of rows will change), I neglected to copy that code over before.  And, I&#8217;m becoming a fan of the Hungarian notation now too.</p>
<p>However, I have given up on the Array of Arrays or trying to over reach my current understanding level of the Cell/Row as an Object of the Range Object (for an implicit array, if you will), and just looped through the cells in each range.  It actually gives a nice effect when I turn ScreenUpdating on (=True) to let the user literally see the Macro work for them.  Thankfully my ranges aren&#8217;t too ridiculously large.</p>
<p>Also, thanks for the LBound &amp; UBound explanation, MS does an atrocious job at explaining Objects/Methods/Properties and their Examples are foolishly worse.  So you help clarified that for me.</p>
<p>Onto the next task&#8230; till next time, thanks!<br />
Ross</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-48841</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Wed, 11 Aug 2010 13:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-48841</guid>
		<description>&lt;p&gt;Ross:  Redim vaRngArray(1 to 4) creates a one-dimensional array with four empty slots in it.  All you&#039;re doing with Redim (or Dim) is allocating memory to the array, you&#039;re not actually filling it with anything.  The index values are 1, 2, 3, and 4.  You could Redim vaRngArray(0 to 3) to create a one-dimensional array with four empty slots and indexes of 0, 1, 2, and 3.  In your example, your For Each loop and your array indexes don&#039;t match.  You could change either one.  I prefer starting at 1 for arrays, but others prefer 0.&lt;/p&gt;
&lt;p&gt;For a best practice, you would code&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; j = &lt;span class=&quot;kw1&quot;&gt;LBound&lt;/span&gt;(vaRngArray) &lt;span class=&quot;kw1&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(vaRngArray)&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and it wouldn&#039;t matter what your indexes are.  It would always go from the lower bound to the upper bound, whatever they are.&lt;/p&gt;
&lt;p&gt;In your example, you Dim r1 through r4, but you don&#039;t assign any ranges to them.  If you want to use the r variables, it would look more like this&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; r1 = ActiveSheet.Range(&lt;span class=&quot;st0&quot;&gt;&quot;A1:A10&quot;&lt;/span&gt;)&lt;br&gt;
vaRngArray(1) = r1.Value&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The error you&#039;re getting is because the code doesn&#039;t know what r1 refers to.  If you tell me what r1 through r4 are supposed to refer to, I can show you the best way to code it.&lt;/p&gt;
&lt;p&gt;It&#039;s a shame that MS doesn&#039;t Dim their variables.  For Each should look like this&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rCell &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; Range&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; rCell &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; Worksheets(&lt;span class=&quot;st0&quot;&gt;&quot;Sheet1&quot;&lt;/span&gt;).Range(&lt;span class=&quot;st0&quot;&gt;&quot;A1:D10&quot;&lt;/span&gt;).Cells&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I use rCell as my variable name and they use c.  You can use either (or any valid variable name), but I prefer to prefix my range object variables with r and to make the name descriptive.  If I were looping through rows, I would use&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rRow &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; Range&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; rRow &lt;span class=&quot;kw1&quot;&gt;in&lt;/span&gt; Worksheets(&lt;span class=&quot;st0&quot;&gt;&quot;Sheet1&quot;&lt;/span&gt;).Range(&lt;span class=&quot;st0&quot;&gt;&quot;A1:D10&quot;&lt;/span&gt;).Rows&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Both rCell and rRow are Range objects, but in the For Each, they would refer to different things because I&#039;m returning the Cells collection in the first and the Rows collection in the second.  Cells and Rows are both Range objects, but return different subsets of A1:D10.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ross:  Redim vaRngArray(1 to 4) creates a one-dimensional array with four empty slots in it.  All you&#8217;re doing with Redim (or Dim) is allocating memory to the array, you&#8217;re not actually filling it with anything.  The index values are 1, 2, 3, and 4.  You could Redim vaRngArray(0 to 3) to create a one-dimensional array with four empty slots and indexes of 0, 1, 2, and 3.  In your example, your For Each loop and your array indexes don&#8217;t match.  You could change either one.  I prefer starting at 1 for arrays, but others prefer 0.</p>
<p>For a best practice, you would code</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">For</span> j = <span class="kw1">LBound</span>(vaRngArray) <span class="kw1">to</span> <span class="kw1">UBound</span>(vaRngArray)</div>
</div>
<p>and it wouldn&#8217;t matter what your indexes are.  It would always go from the lower bound to the upper bound, whatever they are.</p>
<p>In your example, you Dim r1 through r4, but you don&#8217;t assign any ranges to them.  If you want to use the r variables, it would look more like this</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Set</span> r1 = ActiveSheet.Range(<span class="st0">&#8220;A1:A10&#8243;</span>)<br />
vaRngArray(1) = r1.Value</div>
</div>
<p>The error you&#8217;re getting is because the code doesn&#8217;t know what r1 refers to.  If you tell me what r1 through r4 are supposed to refer to, I can show you the best way to code it.</p>
<p>It&#8217;s a shame that MS doesn&#8217;t Dim their variables.  For Each should look like this</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Dim</span> rCell <span class="kw1">as</span> Range<br />
<span class="kw1">For</span> <span class="kw1">Each</span> rCell <span class="kw1">In</span> Worksheets(<span class="st0">&#8220;Sheet1&#8243;</span>).Range(<span class="st0">&#8220;A1:D10&#8243;</span>).Cells</div>
</div>
<p>I use rCell as my variable name and they use c.  You can use either (or any valid variable name), but I prefer to prefix my range object variables with r and to make the name descriptive.  If I were looping through rows, I would use</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Dim</span> rRow <span class="kw1">as</span> Range<br />
<span class="kw1">For</span> <span class="kw1">Each</span> rRow <span class="kw1">in</span> Worksheets(<span class="st0">&#8220;Sheet1&#8243;</span>).Range(<span class="st0">&#8220;A1:D10&#8243;</span>).Rows</div>
</div>
<p>Both rCell and rRow are Range objects, but in the For Each, they would refer to different things because I&#8217;m returning the Cells collection in the first and the Rows collection in the second.  Cells and Rows are both Range objects, but return different subsets of A1:D10.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-48818</link>
		<dc:creator>Ross</dc:creator>
		<pubDate>Tue, 10 Aug 2010 19:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-48818</guid>
		<description>&lt;p&gt;Hey Dick, thanks for the suggestion, I&#039;m testing your method out and here&#039;s my code.  I&#039;m getting an &quot;Application or &#039;Object&#039; definted error and I&#039;m not sure what&#039;s the root cause.  I have tried a few permutations of properties and left you with my most recent (failed) attempt of .Cells.Value.  Also does ReDim with &quot;(1 To 4)&quot; dimension an array 1×4 (or 4×1) with index values 0,1,2,3?  &lt;/p&gt;
&lt;p&gt;I&#039;ve begun learning VBA (Excel 2000, VBE v6.3) this summer, diving in pretty deep, but you can you or anyone else tell me more about using a For Each Loop with the Cells (Collection)Object of the Range Object?  M$ claims this here &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa221353&quot; rel=&quot;nofollow&quot;&gt;http://msdn.microsoft.com/en-us/library/aa221353&lt;/a&gt;(office.11).aspx  but I couldn&#039;t get it to work.  Their &#039;c&#039; variable/counter/object isn&#039;t defined clearly...&lt;br&gt;
______________________________________________________________&lt;br&gt;
Dim r1, r2, r3, r4 As Range&lt;br&gt;
Dim vaRngArray() As Variant&lt;/p&gt;
&lt;p&gt;ReDim vaRngArray(1 To 4)&lt;br&gt;
    With ActiveSheet&lt;br&gt;
    For j = 0 To 3&lt;br&gt;
        Select Case j&lt;br&gt;
            Case j = 1&lt;br&gt;
                vaRngArray(j) = .Range(r1).Cells.Value&lt;br&gt;
            Case j = 2&lt;br&gt;
                vaRngArray(j) = .Range(r2).Value&lt;br&gt;
            Case j = 3&lt;br&gt;
                vaRngArray(j) = .Range(r3).Value&lt;br&gt;
            Case j = 4&lt;br&gt;
                vaRngArray(j) = .Range(r4).Value&lt;br&gt;
        End Select&lt;br&gt;
    Next j&lt;br&gt;
__________________________________________________________________&lt;br&gt;
Thanks! I really appreciate the help!&lt;br&gt;
~Rawesome&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey Dick, thanks for the suggestion, I&#8217;m testing your method out and here&#8217;s my code.  I&#8217;m getting an &#8220;Application or &#8216;Object&#8217; definted error and I&#8217;m not sure what&#8217;s the root cause.  I have tried a few permutations of properties and left you with my most recent (failed) attempt of .Cells.Value.  Also does ReDim with &#8220;(1 To 4)&#8221; dimension an array 1×4 (or 4×1) with index values 0,1,2,3?  </p>
<p>I&#8217;ve begun learning VBA (Excel 2000, VBE v6.3) this summer, diving in pretty deep, but you can you or anyone else tell me more about using a For Each Loop with the Cells (Collection)Object of the Range Object?  M$ claims this here <a href="http://msdn.microsoft.com/en-us/library/aa221353" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa221353</a>(office.11).aspx  but I couldn&#8217;t get it to work.  Their &#8216;c&#8217; variable/counter/object isn&#8217;t defined clearly&#8230;<br />
______________________________________________________________<br />
Dim r1, r2, r3, r4 As Range<br />
Dim vaRngArray() As Variant</p>
<p>ReDim vaRngArray(1 To 4)<br />
    With ActiveSheet<br />
    For j = 0 To 3<br />
        Select Case j<br />
            Case j = 1<br />
                vaRngArray(j) = .Range(r1).Cells.Value<br />
            Case j = 2<br />
                vaRngArray(j) = .Range(r2).Value<br />
            Case j = 3<br />
                vaRngArray(j) = .Range(r3).Value<br />
            Case j = 4<br />
                vaRngArray(j) = .Range(r4).Value<br />
        End Select<br />
    Next j<br />
__________________________________________________________________<br />
Thanks! I really appreciate the help!<br />
~Rawesome</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-48813</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Tue, 10 Aug 2010 16:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-48813</guid>
		<description>&lt;p&gt;Ross: You don&#039;t need to put them in their own array variables, unless you need to do it for some other reason.  Let&#039;s say you have data in A1:D4 and you want each column to be a separate array inside a larger array.&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; RangeArrays()&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; vaRangeArr &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;ReDim&lt;/span&gt; vaRangeArr(1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 4)&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 4&lt;br&gt;
&#160; &#160; &#160; &#160; vaRangeArr(i) = Sheet1.Range(&lt;span class=&quot;st0&quot;&gt;&quot;A1:A4&quot;&lt;/span&gt;).Offset(0, i - 1).Value&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 4&lt;br&gt;
&#160; &#160; &#160; &#160; Debug.&lt;span class=&quot;kw1&quot;&gt;Print&lt;/span&gt; vaRangeArr(i)(i, 1)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;br&gt;
&#160; &#160; &lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;First Redim vaRangeArr so it can hold four elements.  Then put the Value of the range into each element.  I use a loop because my ranges are all neatly arranged, but you could do it more explicitly like&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;vaRangeArray(1) = Sheet1.Range(&lt;span class=&quot;st0&quot;&gt;&quot;A1:A4&quot;&lt;/span&gt;).Value&lt;br&gt;
vaRangeArray(2) = Sheet1.Range(&lt;span class=&quot;st0&quot;&gt;&quot;B1:B4&quot;&lt;/span&gt;).Value&lt;br&gt;
vaRangeArray(3) = Sheet1.Range(&lt;span class=&quot;st0&quot;&gt;&quot;C1:C4&quot;&lt;/span&gt;)Value&lt;br&gt;
vaRangeArray(4) = Sheet1.Range(&lt;span class=&quot;st0&quot;&gt;&quot;D1:D4&quot;&lt;/span&gt;).Value&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The next loop just prints one element from each array.  Note that the higher level array is one dimension (vaRangeArr(i)), but the arrays inside it are two dimensions.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ross: You don&#8217;t need to put them in their own array variables, unless you need to do it for some other reason.  Let&#8217;s say you have data in A1:D4 and you want each column to be a separate array inside a larger array.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> RangeArrays()<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">Dim</span> vaRangeArr <span class="kw1">As</span> <span class="kw1">Variant</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> i <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">ReDim</span> vaRangeArr(1 <span class="kw1">To</span> 4)<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">For</span> i = 1 <span class="kw1">To</span> 4<br />
&nbsp; &nbsp; &nbsp; &nbsp; vaRangeArr(i) = Sheet1.Range(<span class="st0">&#8220;A1:A4&#8243;</span>).Offset(0, i &#8211; 1).Value<br />
&nbsp; &nbsp; <span class="kw1">Next</span> i<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">For</span> i = 1 <span class="kw1">To</span> 4<br />
&nbsp; &nbsp; &nbsp; &nbsp; Debug.<span class="kw1">Print</span> vaRangeArr(i)(i, 1)<br />
&nbsp; &nbsp; <span class="kw1">Next</span> i<br />
&nbsp; &nbsp; <br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
<p>First Redim vaRangeArr so it can hold four elements.  Then put the Value of the range into each element.  I use a loop because my ranges are all neatly arranged, but you could do it more explicitly like</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">vaRangeArray(1) = Sheet1.Range(<span class="st0">&#8220;A1:A4&#8243;</span>).Value<br />
vaRangeArray(2) = Sheet1.Range(<span class="st0">&#8220;B1:B4&#8243;</span>).Value<br />
vaRangeArray(3) = Sheet1.Range(<span class="st0">&#8220;C1:C4&#8243;</span>)Value<br />
vaRangeArray(4) = Sheet1.Range(<span class="st0">&#8220;D1:D4&#8243;</span>).Value</div>
</div>
<p>The next loop just prints one element from each array.  Note that the higher level array is one dimension (vaRangeArr(i)), but the arrays inside it are two dimensions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-48795</link>
		<dc:creator>Ross</dc:creator>
		<pubDate>Mon, 09 Aug 2010 22:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-48795</guid>
		<description>&lt;p&gt;My question is about Dim-ing the Array.  I see you&#039;ve created vaTest as Variant.  I have 4 ranges called r1,r2,r3 and r4.  I used &#039;transpose&#039; to put them into 2D arrays(ie - ar1, ar2, ar3, ar4), and I now want to make an Array of those arrays.  How do I create/define/set RngArray()() to consist of RngArray(ar1,ar2,ar3,ar4)?&lt;/p&gt;
&lt;p&gt;Do I need to put it as RngArray = Array(Array(ar1), Array(ar2), Array(ar3), Array(ar4))?  Do I need quotes?&lt;/p&gt;
&lt;p&gt;Also, I&#039;ve found elsewhere using Cells as a Collection within a Range to cycle/loop through and perform a test or filter on cell contents (either value or string), does anyone have a good resource/advice with regard to this?  It&#039;s an alternative, possibly simpler solution.&lt;/p&gt;
&lt;p&gt;Thanks in advance!&lt;br&gt;
Ross&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>My question is about Dim-ing the Array.  I see you&#8217;ve created vaTest as Variant.  I have 4 ranges called r1,r2,r3 and r4.  I used &#8216;transpose&#8217; to put them into 2D arrays(ie &#8211; ar1, ar2, ar3, ar4), and I now want to make an Array of those arrays.  How do I create/define/set RngArray()() to consist of RngArray(ar1,ar2,ar3,ar4)?</p>
<p>Do I need to put it as RngArray = Array(Array(ar1), Array(ar2), Array(ar3), Array(ar4))?  Do I need quotes?</p>
<p>Also, I&#8217;ve found elsewhere using Cells as a Collection within a Range to cycle/loop through and perform a test or filter on cell contents (either value or string), does anyone have a good resource/advice with regard to this?  It&#8217;s an alternative, possibly simpler solution.</p>
<p>Thanks in advance!<br />
Ross</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: P. Michael</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/11/29/arrays-in-arrays/#comment-41866</link>
		<dc:creator>P. Michael</dc:creator>
		<pubDate>Wed, 28 Oct 2009 12:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=885#comment-41866</guid>
		<description>&lt;p&gt;Say I have vaTest = Array(Array(Banana, Orange, Apple), Array(5, 3, 7))&lt;br&gt;
I want to sort the quantity of the fruits and list out with thew name of the fruit against the quantity like this:&lt;/p&gt;
&lt;p&gt;Orange - 3&lt;br&gt;
Banana - 5&lt;br&gt;
Apple - 7&lt;br&gt;
How to sort? Pl. help.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Say I have vaTest = Array(Array(Banana, Orange, Apple), Array(5, 3, 7))<br />
I want to sort the quantity of the fruits and list out with thew name of the fruit against the quantity like this:</p>
<p>Orange &#8211; 3<br />
Banana &#8211; 5<br />
Apple &#8211; 7<br />
How to sort? Pl. help.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

