<?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: Redim an Array</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/</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: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-54578</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Wed, 24 Nov 2010 06:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-54578</guid>
		<description>&lt;p&gt;Dick Kusleika wrote:&lt;br&gt;
 begin quote &lt;br&gt;
Bill: Here&#039;s my coding philosophy&lt;/p&gt;
&lt;p&gt;1. Code so that it works&lt;br&gt;
2. Code so that it&#039;s pretty&lt;br&gt;
3. Code so that it&#039;s fast&lt;br&gt;
-- end quote --&lt;/p&gt;
&lt;p&gt;Glad to see &quot;it&#039;s fast&quot; is last. {grin}&lt;/p&gt;
&lt;p&gt;I find it both sad and hilarious that there are so many who want to make their solution &quot;fast.&quot;  The result often is that that they get the wrong result very, very fast. {vbg}&lt;/p&gt;
&lt;p&gt;If by &quot;pretty&quot; you mean readable and maintainable, you will find that if you make it #1, the &quot;it works&quot; will follow naturally.  So,&lt;/p&gt;
&lt;p&gt;1. Invest the time to find / create a good algorithm&lt;br&gt;
2. Implement it in a readable and maintainable manner&lt;br&gt;
3. If the performance is not acceptable&lt;br&gt;
... 3.1 See if tweaking the existing implementation does the job w/o sacrificing too much of #2.&lt;br&gt;
... 3.2 If not, try and find a better algorithm&lt;br&gt;
... 3.3 If none can be found, stick with 3.1&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick Kusleika wrote:<br />
 begin quote <br />
Bill: Here&#8217;s my coding philosophy</p>
<p>1. Code so that it works<br />
2. Code so that it&#8217;s pretty<br />
3. Code so that it&#8217;s fast<br />
&#8211; end quote &#8211;</p>
<p>Glad to see &#8220;it&#8217;s fast&#8221; is last. {grin}</p>
<p>I find it both sad and hilarious that there are so many who want to make their solution &#8220;fast.&#8221;  The result often is that that they get the wrong result very, very fast. {vbg}</p>
<p>If by &#8220;pretty&#8221; you mean readable and maintainable, you will find that if you make it #1, the &#8220;it works&#8221; will follow naturally.  So,</p>
<p>1. Invest the time to find / create a good algorithm<br />
2. Implement it in a readable and maintainable manner<br />
3. If the performance is not acceptable<br />
&#8230; 3.1 See if tweaking the existing implementation does the job w/o sacrificing too much of #2.<br />
&#8230; 3.2 If not, try and find a better algorithm<br />
&#8230; 3.3 If none can be found, stick with 3.1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Brunt</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-54556</link>
		<dc:creator>Bill Brunt</dc:creator>
		<pubDate>Wed, 24 Nov 2010 00:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-54556</guid>
		<description>&lt;p&gt;Dick - Thanks for your reply. Great philosphy.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick &#8211; Thanks for your reply. Great philosphy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-54553</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Tue, 23 Nov 2010 22:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-54553</guid>
		<description>&lt;p&gt;Bill:  Here&#039;s my coding philosophy&lt;/p&gt;
&lt;p&gt;1.  Code so that it works&lt;br&gt;
2.  Code so that it&#039;s pretty&lt;br&gt;
3.  Code so that it&#039;s fast&lt;/p&gt;
&lt;p&gt;At #3, I put a timer on the code and work on the biggest time sinks until it&#039;s fast enough.  Expensive though it may be, I&#039;ve *never* had to change to block redims to improve performance. It&#039;s not that I&#039;m not a fan (although that&#039;s exactly what I said), I&#039;m just not a fan of coding for speed before measuring.  If I ever work with a large enough data set, individual redims may make the cut, although it&#039;s as likely I will find a faster way to compute the upper bound outside of the loop.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Bill:  Here&#8217;s my coding philosophy</p>
<p>1.  Code so that it works<br />
2.  Code so that it&#8217;s pretty<br />
3.  Code so that it&#8217;s fast</p>
<p>At #3, I put a timer on the code and work on the biggest time sinks until it&#8217;s fast enough.  Expensive though it may be, I&#8217;ve *never* had to change to block redims to improve performance. It&#8217;s not that I&#8217;m not a fan (although that&#8217;s exactly what I said), I&#8217;m just not a fan of coding for speed before measuring.  If I ever work with a large enough data set, individual redims may make the cut, although it&#8217;s as likely I will find a faster way to compute the upper bound outside of the loop.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Brunt</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-54534</link>
		<dc:creator>Bill Brunt</dc:creator>
		<pubDate>Tue, 23 Nov 2010 16:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-54534</guid>
		<description>&lt;p&gt;Dick -- I was curious why you&#039;re not a fan of block ReDim?&lt;/p&gt;
&lt;p&gt;I was considering such an approach as I am potentially dealing with a fair amount of data and want to know what people thought of this. Is it the extra work(code) or is it something else?&lt;/p&gt;
&lt;p&gt;Great thread.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick &#8212; I was curious why you&#8217;re not a fan of block ReDim?</p>
<p>I was considering such an approach as I am potentially dealing with a fair amount of data and want to know what people thought of this. Is it the extra work(code) or is it something else?</p>
<p>Great thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-41112</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Sun, 20 Sep 2009 23:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-41112</guid>
		<description>&lt;p&gt;Jon - it doesn&#039;t seem to be an XL 2007 thing though.  On my old computer the Redim works without a Dim statement in both 2000 and 2007, but on the new computer it doesn&#039;t work in 2007.  I haven&#039;t installed any older versions yet.&lt;/p&gt;
&lt;p&gt;I thought it might have something to do with the Perfmon utility, which is installed on the old computer and not the new one, but disabling this and removing the reference to it seems to make no difference.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Jon &#8211; it doesn&#8217;t seem to be an XL 2007 thing though.  On my old computer the Redim works without a Dim statement in both 2000 and 2007, but on the new computer it doesn&#8217;t work in 2007.  I haven&#8217;t installed any older versions yet.</p>
<p>I thought it might have something to do with the Perfmon utility, which is installed on the old computer and not the new one, but disabling this and removing the reference to it seems to make no difference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-41027</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Wed, 16 Sep 2009 16:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-41027</guid>
		<description>&lt;p&gt;Doug -&lt;/p&gt;
&lt;p&gt;I always thought one had to Dim a variable before it could be ReDimmed, but a quick test in 2003 showed that I was wrong (which happens so rarely!).&lt;/p&gt;
&lt;p&gt;I have heard of a number of unexpected VBA changes in 2007, which are pretty much the same as this: minor but annoying.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Doug -</p>
<p>I always thought one had to Dim a variable before it could be ReDimmed, but a quick test in 2003 showed that I was wrong (which happens so rarely!).</p>
<p>I have heard of a number of unexpected VBA changes in 2007, which are pretty much the same as this: minor but annoying.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Jenkins</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-41003</link>
		<dc:creator>Doug Jenkins</dc:creator>
		<pubDate>Tue, 15 Sep 2009 01:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-41003</guid>
		<description>&lt;p&gt;I have just come across a curious problem with re-dimming.&lt;/p&gt;
&lt;p&gt;I have the following code:&lt;/p&gt;
&lt;p&gt;Option explicit&lt;br&gt;
Function Elastic( ...&lt;br&gt;
&#039; Dim statements with no reference to RLayers()&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;ReDim RLayers(1 To NumReo + 1, 1 To 18)&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;p&gt;On my old computer this works without complaint.&lt;/p&gt;
&lt;p&gt;On my new computer with the same Excel (2007) and the same OS (Vista) I get the compile error:&lt;/p&gt;
&lt;p&gt;&quot;Can&#039;t find project or library&quot;&lt;/p&gt;
&lt;p&gt;I can make the problem go away by inserting a Dim statement (Dim RLayers() as double), which obviously I should have done in the first place, but I&#039;m curious as to why I&#039;m getting this different behaviour.&lt;/p&gt;
&lt;p&gt;I can&#039;t see any differences in the VBA references list in the two computers.&lt;/p&gt;
&lt;p&gt;Any other ideas what might cause the difference in behaviour?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have just come across a curious problem with re-dimming.</p>
<p>I have the following code:</p>
<p>Option explicit<br />
Function Elastic( &#8230;<br />
&#8216; Dim statements with no reference to RLayers()</p>
<p>&#8230;</p>
<p>ReDim RLayers(1 To NumReo + 1, 1 To 18)</p>
<p>&#8230;</p>
<p>End Function</p>
<p>On my old computer this works without complaint.</p>
<p>On my new computer with the same Excel (2007) and the same OS (Vista) I get the compile error:</p>
<p>&#8220;Can&#8217;t find project or library&#8221;</p>
<p>I can make the problem go away by inserting a Dim statement (Dim RLayers() as double), which obviously I should have done in the first place, but I&#8217;m curious as to why I&#8217;m getting this different behaviour.</p>
<p>I can&#8217;t see any differences in the VBA references list in the two computers.</p>
<p>Any other ideas what might cause the difference in behaviour?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Owen</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-33322</link>
		<dc:creator>Owen</dc:creator>
		<pubDate>Fri, 04 Jul 2008 07:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-33322</guid>
		<description>&lt;p&gt;I regularly use sub procedures to resize arrays. In fact, if I couldn&#039;t do that, I&#039;d say 90% of my VBA code would fail to work.&lt;/p&gt;
&lt;p&gt;If you are using arrays to create lists of data so you may paste the entire list into an Excel spreadsheet using a single paste operation, then it&#039;s generally a matter of transposing the array, using ReDim Preserve, adding your extra information, and then transposing it back to the way it was.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I regularly use sub procedures to resize arrays. In fact, if I couldn&#8217;t do that, I&#8217;d say 90% of my VBA code would fail to work.</p>
<p>If you are using arrays to create lists of data so you may paste the entire list into an Excel spreadsheet using a single paste operation, then it&#8217;s generally a matter of transposing the array, using ReDim Preserve, adding your extra information, and then transposing it back to the way it was.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Duhon</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-1865</link>
		<dc:creator>Jay Duhon</dc:creator>
		<pubDate>Thu, 26 Aug 2004 16:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-1865</guid>
		<description>&lt;p&gt;&gt; If you pass an array to a procedure by reference, you can&#039;t redimension the array within the procedure.&lt;/p&gt;
&lt;p&gt;I&#039;ve seen that in the help before, but I&#039;ve never seen where it causes a problem.&lt;/p&gt;
&lt;p&gt;I&#039;ve always been able to do this:&lt;/p&gt;
&lt;p&gt;Dim arrTest() As Long&lt;/p&gt;
&lt;p&gt;ReDim arrTest(1)&lt;br&gt;
MsgBox &quot;UBound(arrTest) = &quot; &amp; UBound(arrTest)&lt;br&gt;
Procedure1 arrTest&lt;br&gt;
MsgBox &quot;UBound(arrTest) = &quot; &amp; UBound(arrTest)&lt;/p&gt;
&lt;p&gt;Sub Procedure1(ByRef arr() As Long)&lt;br&gt;
    ReDim arr(10)&lt;br&gt;
    MsgBox &quot;UBound(arrTest) = &quot; &amp; UBound(arr), , &quot;Procedure1?&lt;br&gt;
End Sub&lt;/p&gt;
&lt;p&gt;Could someone please explain when this wouldn&#039;t work? Or why the help file says that, even though it is apparently not true?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&gt; If you pass an array to a procedure by reference, you can&#8217;t redimension the array within the procedure.</p>
<p>I&#8217;ve seen that in the help before, but I&#8217;ve never seen where it causes a problem.</p>
<p>I&#8217;ve always been able to do this:</p>
<p>Dim arrTest() As Long</p>
<p>ReDim arrTest(1)<br />
MsgBox &#8220;UBound(arrTest) = &#8221; &amp; UBound(arrTest)<br />
Procedure1 arrTest<br />
MsgBox &#8220;UBound(arrTest) = &#8221; &amp; UBound(arrTest)</p>
<p>Sub Procedure1(ByRef arr() As Long)<br />
    ReDim arr(10)<br />
    MsgBox &#8220;UBound(arrTest) = &#8221; &amp; UBound(arr), , &#8220;Procedure1?<br />
End Sub</p>
<p>Could someone please explain when this wouldn&#8217;t work? Or why the help file says that, even though it is apparently not true?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie Collins</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/28/redim-an-array/#comment-1864</link>
		<dc:creator>Jamie Collins</dc:creator>
		<pubDate>Tue, 29 Jun 2004 11:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=659#comment-1864</guid>
		<description>&lt;p&gt;Some important points from the VBA help:&lt;/p&gt;
&lt;p&gt;If you use the Preserve keyword, you can resize only the last array dimension and you can&#039;t change the number of dimensions at all. &lt;/p&gt;
&lt;p&gt;Similarly, when you use Preserve, you can change the size of the array only by changing the upper bound.&lt;/p&gt;
&lt;p&gt;If you pass an array to a procedure by reference, you can&#039;t redimension the array within the procedure.&lt;/p&gt;
&lt;p&gt;Jamie.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Some important points from the VBA help:</p>
<p>If you use the Preserve keyword, you can resize only the last array dimension and you can&#8217;t change the number of dimensions at all. </p>
<p>Similarly, when you use Preserve, you can change the size of the array only by changing the upper bound.</p>
<p>If you pass an array to a procedure by reference, you can&#8217;t redimension the array within the procedure.</p>
<p>Jamie.</p>
<p></p>
]]></content:encoded>
	</item>
</channel>
</rss>

