<?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: Dynamic Sorting With a UDF</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/</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: Jon</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-67119</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Tue, 18 Oct 2011 17:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-67119</guid>
		<description>&lt;p&gt;Nevermind, I changed the .Cell(5, 10) and that worked.  I had inadvertently pasted this function into two different spots and was modifying the wrong one.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nevermind, I changed the .Cell(5, 10) and that worked.  I had inadvertently pasted this function into two different spots and was modifying the wrong one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-67117</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Tue, 18 Oct 2011 17:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-67117</guid>
		<description>&lt;p&gt;I have a range $A$5:$K$26.  I want to sort on the J column, how do I modify the code to do this?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have a range $A$5:$K$26.  I want to sort on the J column, how do I modify the code to do this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43887</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Thu, 11 Feb 2010 14:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43887</guid>
		<description>&lt;p&gt;Bill, put your code in code tags.  See the instructions just above the comment box.  This will preserve the code and format it correctly.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Bill, put your code in code tags.  See the instructions just above the comment box.  This will preserve the code and format it correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Ghauri</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43858</link>
		<dc:creator>Bill Ghauri</dc:creator>
		<pubDate>Wed, 10 Feb 2010 22:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43858</guid>
		<description>&lt;p&gt;One more time.  If this doesn&#039;t work, my apologies for mucking up this thread.&lt;/p&gt;
&lt;p&gt;Function Vol_ID(Vol_0 As Long, volRng As Range)&lt;br&gt;
Dim vArray As Variant&lt;br&gt;
vArray = volRng.Value&lt;br&gt;
QuickSort vArray, LBound(vArray, 1), UBound(vArray, 1)&lt;br&gt;
Select Case True&lt;br&gt;
Case Is = Vol_0  vArray(5, 1) And Vol_0  vArray(17, 1) And Vol_0  vArray(29, 1) And Vol_0  vArray(41, 1) And Vol_0  vArray(53, 1)&lt;br&gt;
Vol_ID = &quot;EXTM&quot;&lt;br&gt;
End Select&lt;br&gt;
End Function&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>One more time.  If this doesn&#8217;t work, my apologies for mucking up this thread.</p>
<p>Function Vol_ID(Vol_0 As Long, volRng As Range)<br />
Dim vArray As Variant<br />
vArray = volRng.Value<br />
QuickSort vArray, LBound(vArray, 1), UBound(vArray, 1)<br />
Select Case True<br />
Case Is = Vol_0  vArray(5, 1) And Vol_0  vArray(17, 1) And Vol_0  vArray(29, 1) And Vol_0  vArray(41, 1) And Vol_0  vArray(53, 1)<br />
Vol_ID = &#8220;EXTM&#8221;<br />
End Select<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Ghauri</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43857</link>
		<dc:creator>Bill Ghauri</dc:creator>
		<pubDate>Wed, 10 Feb 2010 22:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43857</guid>
		<description>&lt;p&gt;Maybe this time...&lt;/p&gt;
&lt;p&gt;Function Vol_ID(Vol_0 As Long, volRng As Range)&lt;br&gt;
Dim vArray As Variant&lt;br&gt;
vArray = volRng.Value&lt;br&gt;
QuickSort vArray, LBound(vArray, 1), UBound(vArray, 1)&lt;br&gt;
Select Case True&lt;br&gt;
Case Is = Vol_0  vArray(5, 1) And Vol_0  vArray(17, 1) And Vol_0  vArray(29, 1) And Vol_0  vArray(41, 1) And Vol_0  vArray(53, 1)&lt;br&gt;
Vol_ID = &quot;EXTM&quot;&lt;br&gt;
End Select&lt;br&gt;
End Function&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Maybe this time&#8230;</p>
<p>Function Vol_ID(Vol_0 As Long, volRng As Range)<br />
Dim vArray As Variant<br />
vArray = volRng.Value<br />
QuickSort vArray, LBound(vArray, 1), UBound(vArray, 1)<br />
Select Case True<br />
Case Is = Vol_0  vArray(5, 1) And Vol_0  vArray(17, 1) And Vol_0  vArray(29, 1) And Vol_0  vArray(41, 1) And Vol_0  vArray(53, 1)<br />
Vol_ID = &#8220;EXTM&#8221;<br />
End Select<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Ghauri</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43856</link>
		<dc:creator>Bill Ghauri</dc:creator>
		<pubDate>Wed, 10 Feb 2010 22:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43856</guid>
		<description>&lt;p&gt;I must have messed up posting because it cut out some of my code.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I must have messed up posting because it cut out some of my code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Ghauri</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43855</link>
		<dc:creator>Bill Ghauri</dc:creator>
		<pubDate>Wed, 10 Feb 2010 22:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43855</guid>
		<description>&lt;p&gt;@ Jon,&lt;/p&gt;
&lt;p&gt;I wanted to use a UDF that I could call from another sub, but I suppose the LARGE function would work too.  I did not try it.  In my model I had been been using a sub to copy/sort the values on a worksheet.  It worked, but I needed to steamline the model as much as possible and I figured a UDF was the best route.  Btw, this is how my final function looks with the Select Case construct.  It works great.&lt;/p&gt;
&lt;p&gt;Function Vol_ID(Vol_0 As Long, volRng As Range)&lt;br&gt;
    Dim vArray As Variant&lt;br&gt;
    vArray = volRng.Value&lt;br&gt;
    QuickSort vArray, LBound(vArray, 1), UBound(vArray, 1)&lt;br&gt;
    Select Case True&lt;br&gt;
        Case Is = Vol_0  vArray(5, 1) And Vol_0  vArray(17, 1) And Vol_0  vArray(29, 1) And Vol_0  vArray(41, 1) And Vol_0  vArray(53, 1)&lt;br&gt;
            Vol_ID = &quot;EXTM&quot;&lt;br&gt;
    End Select&lt;br&gt;
End Function&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br&gt;
Bill Ghauri&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@ Jon,</p>
<p>I wanted to use a UDF that I could call from another sub, but I suppose the LARGE function would work too.  I did not try it.  In my model I had been been using a sub to copy/sort the values on a worksheet.  It worked, but I needed to steamline the model as much as possible and I figured a UDF was the best route.  Btw, this is how my final function looks with the Select Case construct.  It works great.</p>
<p>Function Vol_ID(Vol_0 As Long, volRng As Range)<br />
    Dim vArray As Variant<br />
    vArray = volRng.Value<br />
    QuickSort vArray, LBound(vArray, 1), UBound(vArray, 1)<br />
    Select Case True<br />
        Case Is = Vol_0  vArray(5, 1) And Vol_0  vArray(17, 1) And Vol_0  vArray(29, 1) And Vol_0  vArray(41, 1) And Vol_0  vArray(53, 1)<br />
            Vol_ID = &#8220;EXTM&#8221;<br />
    End Select<br />
End Function</p>
<p>Best regards,<br />
Bill Ghauri</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43853</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Wed, 10 Feb 2010 21:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43853</guid>
		<description>&lt;p&gt;What&#039;s wrong with =LARGE(array,k)?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>What&#8217;s wrong with =LARGE(array,k)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Ghauri</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43850</link>
		<dc:creator>Bill Ghauri</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43850</guid>
		<description>&lt;p&gt;@ Dick,&lt;/p&gt;
&lt;p&gt;I kind of boggles my mind how you experts can figure this stuff out so fast!  You solution works great!  Many thanks.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br&gt;
Bill Ghauri&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@ Dick,</p>
<p>I kind of boggles my mind how you experts can figure this stuff out so fast!  You solution works great!  Many thanks.</p>
<p>Best regards,<br />
Bill Ghauri</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/01/23/dynamic-sorting-with-a-udf/#comment-43848</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Wed, 10 Feb 2010 17:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1591#comment-43848</guid>
		<description>&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;Function&lt;/span&gt; PositionValue(VolRng &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range, &lt;span class=&quot;kw1&quot;&gt;Optional&lt;/span&gt; lPos &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt; = 1)&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; vArray &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;br&gt;
&#160; &#160; vArray = VolRng.Value&lt;br&gt;
&#160; &#160; QuickSort vArray, &lt;span class=&quot;kw1&quot;&gt;LBound&lt;/span&gt;(vArray, 1), &lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(vArray, 1)&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; PositionValue = vArray(lPos, 1)&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;Function&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; QuickSort(vArray &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;, inLow &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, inHigh &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;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; vPivot &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; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; vSwap &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; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lLow &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; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lHigh &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;
&lt;br&gt;
&#160; lLow = inLow&lt;br&gt;
&#160; lHigh = inHigh&lt;br&gt;
&lt;br&gt;
&#160; vPivot = vArray((inLow + inHigh)  2, 1)&lt;br&gt;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;While&lt;/span&gt; lLow &lt;= lHigh&lt;br&gt;
&lt;br&gt;
&#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;While&lt;/span&gt; vArray(lLow, 1) &lt; vPivot &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; lLow &lt; inHigh&lt;br&gt;
&#160; &#160; &#160; &#160; lLow = lLow + 1&lt;br&gt;
&#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Do&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;While&lt;/span&gt; vPivot &lt; vArray(lHigh, 1) &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; lHigh &gt; inLow&lt;br&gt;
&#160; &#160; &#160; &#160; lHigh = lHigh - 1&lt;br&gt;
&#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; (lLow &lt;= lHigh) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; vSwap = vArray(lLow, 1)&lt;br&gt;
&#160; &#160; &#160; &#160; vArray(lLow, 1) = vArray(lHigh, 1)&lt;br&gt;
&#160; &#160; &#160; &#160; vArray(lHigh, 1) = vSwap&lt;br&gt;
&#160; &#160; &#160; &#160; lLow = lLow + 1&lt;br&gt;
&#160; &#160; &#160; &#160; lHigh = lHigh - 1&lt;br&gt;
&#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Loop&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; (inLow &lt; lHigh) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; QuickSort vArray, inLow, lHigh&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; (lLow &lt; inHigh) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; QuickSort vArray, lLow, inHigh&lt;br&gt;
&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;The low and high that you pass in are the bounds of the array, not the minimum and maximum values.  Also, the range array of values is two dimensional, so all your array references needed a second dimension.  Also, you are pulling the 3rd value from the range which ignores the sorting that was done.&lt;/p&gt;
&lt;p&gt;Quicksort adapted from here &lt;a href=&quot;http://stackoverflow.com/questions/152319/vba-array-sort-function&quot; rel=&quot;nofollow&quot;&gt;http://stackoverflow.com/questions/152319/vba-array-sort-function&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Function</span> PositionValue(VolRng <span class="kw1">As</span> Range, <span class="kw1">Optional</span> lPos <span class="kw1">As</span> <span class="kw1">Long</span> = 1)<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">Dim</span> vArray <span class="kw1">As</span> <span class="kw1">Variant</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; vArray = VolRng.Value<br />
&nbsp; &nbsp; QuickSort vArray, <span class="kw1">LBound</span>(vArray, 1), <span class="kw1">UBound</span>(vArray, 1)<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; PositionValue = vArray(lPos, 1)<br />
&nbsp; &nbsp; <br />
<span class="kw1">End</span> <span class="kw1">Function</span></p>
<p><span class="kw1">Public</span> <span class="kw1">Sub</span> QuickSort(vArray <span class="kw1">As</span> <span class="kw1">Variant</span>, inLow <span class="kw1">As</span> <span class="kw1">Long</span>, inHigh <span class="kw1">As</span> <span class="kw1">Long</span>)</p>
<p>&nbsp; <span class="kw1">Dim</span> vPivot <span class="kw1">As</span> <span class="kw1">Variant</span><br />
&nbsp; <span class="kw1">Dim</span> vSwap <span class="kw1">As</span> <span class="kw1">Variant</span><br />
&nbsp; <span class="kw1">Dim</span> lLow <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; <span class="kw1">Dim</span> lHigh <span class="kw1">As</span> <span class="kw1">Long</span></p>
<p>&nbsp; lLow = inLow<br />
&nbsp; lHigh = inHigh</p>
<p>&nbsp; vPivot = vArray((inLow + inHigh)  2, 1)</p>
<p>&nbsp; <span class="kw1">Do</span> <span class="kw1">While</span> lLow &lt;= lHigh</p>
<p>&nbsp; &nbsp; &nbsp;<span class="kw1">Do</span> <span class="kw1">While</span> vArray(lLow, 1) &lt; vPivot <span class="kw1">And</span> lLow &lt; inHigh<br />
&nbsp; &nbsp; &nbsp; &nbsp; lLow = lLow + 1<br />
&nbsp; &nbsp; &nbsp;<span class="kw1">Loop</span></p>
<p>&nbsp; &nbsp; &nbsp;<span class="kw1">Do</span> <span class="kw1">While</span> vPivot &lt; vArray(lHigh, 1) <span class="kw1">And</span> lHigh &gt; inLow<br />
&nbsp; &nbsp; &nbsp; &nbsp; lHigh = lHigh &#8211; 1<br />
&nbsp; &nbsp; &nbsp;<span class="kw1">Loop</span></p>
<p>&nbsp; &nbsp; &nbsp;<span class="kw1">If</span> (lLow &lt;= lHigh) <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vSwap = vArray(lLow, 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; vArray(lLow, 1) = vArray(lHigh, 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; vArray(lHigh, 1) = vSwap<br />
&nbsp; &nbsp; &nbsp; &nbsp; lLow = lLow + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; lHigh = lHigh &#8211; 1<br />
&nbsp; &nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">If</span></p>
<p>&nbsp; <span class="kw1">Loop</span></p>
<p>&nbsp; <span class="kw1">If</span> (inLow &lt; lHigh) <span class="kw1">Then</span> QuickSort vArray, inLow, lHigh<br />
&nbsp; <span class="kw1">If</span> (lLow &lt; inHigh) <span class="kw1">Then</span> QuickSort vArray, lLow, inHigh</p>
<p><span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
<p>The low and high that you pass in are the bounds of the array, not the minimum and maximum values.  Also, the range array of values is two dimensional, so all your array references needed a second dimension.  Also, you are pulling the 3rd value from the range which ignores the sorting that was done.</p>
<p>Quicksort adapted from here <a href="http://stackoverflow.com/questions/152319/vba-array-sort-function" rel="nofollow">http://stackoverflow.com/questions/152319/vba-array-sort-function</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

