<?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: My own Euler problem</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 23:42:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Jan Karel Pieterse</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38258</link>
		<dc:creator>Jan Karel Pieterse</dc:creator>
		<pubDate>Sun, 01 Mar 2009 11:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38258</guid>
		<description>&lt;p&gt;Hi Dan,&lt;/p&gt;
&lt;p&gt;I have three textboxes with filter criteria and a table in variant mvTable:&lt;br&gt;
The result is shown in listbox lbxTable.&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; SetFilter()&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lRow &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;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lCol &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;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lFilterColumn &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;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sStr &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; vNewList() &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; lRowCt &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;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sFilter1 &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sFilter2 &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sFilter3 &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&#160; &#160; Application.Cursor = xlWait&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Resume&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; lbxTable.Clear&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;ReDim&lt;/span&gt; vNewList(&lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(mvTable, 1), &lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(mvTable, 2))&lt;br&gt;
&#160; &#160; sFilter1 = LCase(tbxSearchArticle1.Value)&lt;br&gt;
&#160; &#160; sFilter2 = LCase(tbxSearchArticle2.Value)&lt;br&gt;
&#160; &#160; sFilter3 = LCase(tbxSearchArticle3.Value)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Len(sFilter1) + Len(sFilter2) + Len(sFilter3) = 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; lbxTable.List = mvTable&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Else&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; lRow = 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(mvTable, 1)&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; (InStr(LCase(mvTable(lRow, 1)), sFilter1) * Len(sFilter1) + _&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; InStr(LCase(mvTable(lRow, 2)), sFilter2) * Len(sFilter2) + _&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; InStr(LCase(mvTable(lRow, 3)), sFilter3) * Len(sFilter3)) &gt; 0 &lt;span class=&quot;kw1&quot;&gt;Or&lt;/span&gt; lRow = 1 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; lCol = 0 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(mvTable, 2)&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; vNewList(lRowCt, lCol) = mvTable(lRow, lCol + 1)&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lRowCt = lRowCt + 1&lt;br&gt;
&#160; &#160; &#160; &#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;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; lbxTable.List = vNewList&lt;br&gt;
&#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;
&#160; &#160; Application.Cursor = xlDefault&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;
</description>
		<content:encoded><![CDATA[<p>Hi Dan,</p>
<p>I have three textboxes with filter criteria and a table in variant mvTable:<br />
The result is shown in listbox lbxTable.</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> SetFilter()<br />
&nbsp; &nbsp; <span class="kw1">Dim</span> lRow <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> lCol <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> lFilterColumn <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> sStr <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> vNewList() <span class="kw1">As</span> <span class="kw1">Variant</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> lRowCt <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> sFilter1 <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> sFilter2 <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> sFilter3 <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; &nbsp; Application.Cursor = xlWait<br />
&nbsp; &nbsp; <span class="kw1">On</span> <span class="kw1">Error</span> <span class="kw1">Resume</span> <span class="kw1">Next</span><br />
&nbsp; &nbsp; lbxTable.Clear<br />
&nbsp; &nbsp; <span class="kw1">ReDim</span> vNewList(<span class="kw1">UBound</span>(mvTable, 1), <span class="kw1">UBound</span>(mvTable, 2))<br />
&nbsp; &nbsp; sFilter1 = LCase(tbxSearchArticle1.Value)<br />
&nbsp; &nbsp; sFilter2 = LCase(tbxSearchArticle2.Value)<br />
&nbsp; &nbsp; sFilter3 = LCase(tbxSearchArticle3.Value)<br />
&nbsp; &nbsp; <span class="kw1">If</span> Len(sFilter1) + Len(sFilter2) + Len(sFilter3) = 0 <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; lbxTable.List = mvTable<br />
&nbsp; &nbsp; <span class="kw1">Else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">For</span> lRow = 1 <span class="kw1">To</span> <span class="kw1">UBound</span>(mvTable, 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> (InStr(LCase(mvTable(lRow, 1)), sFilter1) * Len(sFilter1) + _<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InStr(LCase(mvTable(lRow, 2)), sFilter2) * Len(sFilter2) + _<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InStr(LCase(mvTable(lRow, 3)), sFilter3) * Len(sFilter3)) &amp;gt; 0 <span class="kw1">Or</span> lRow = 1 <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">For</span> lCol = 0 <span class="kw1">To</span> <span class="kw1">UBound</span>(mvTable, 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vNewList(lRowCt, lCol) = mvTable(lRow, lCol + 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Next</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lRowCt = lRowCt + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Next</span><br />
&nbsp; &nbsp; lbxTable.List = vNewList<br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; Application.Cursor = xlDefault<br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Randles</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38199</link>
		<dc:creator>Dan Randles</dc:creator>
		<pubDate>Thu, 26 Feb 2009 21:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38199</guid>
		<description>&lt;p&gt;&quot;I filter the array in code, not by using Excel, so no problems with discontinuous ranges.&quot;&lt;/p&gt;
&lt;p&gt;How JKP?&lt;/p&gt;
&lt;p&gt;Do you loop over the array and check items?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;I filter the array in code, not by using Excel, so no problems with discontinuous ranges.&#8221;</p>
<p>How JKP?</p>
<p>Do you loop over the array and check items?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Karel Pieterse</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38192</link>
		<dc:creator>Jan Karel Pieterse</dc:creator>
		<pubDate>Thu, 26 Feb 2009 11:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38192</guid>
		<description>&lt;p&gt;I filter the array in code, not by using Excel, so no problems with discontinuous ranges.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I filter the array in code, not by using Excel, so no problems with discontinuous ranges.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Randles</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38190</link>
		<dc:creator>Dan Randles</dc:creator>
		<pubDate>Thu, 26 Feb 2009 09:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38190</guid>
		<description>&lt;p&gt;&quot;Load table (on sheet) in Variant, pass variant to listbox. Then when filtering is needed, create extra variant array that holds the filtered items and pass that into the listbox. Very fast!&quot;&lt;/p&gt;
&lt;p&gt;I&#039;ve tried this and can&#039;t seem to get it to work....&lt;/p&gt;
&lt;p&gt;I think the problem is that the variant array represents a non-contiguous group of cells (ie the filtered list).  So when filtering on ItemA (of which there are 4 in the list) only one appears in the list box.&lt;/p&gt;
&lt;p&gt;I&#039;ve developed a work around which involves copying the filtered list (ie visible cells) to another sheet and then using this list (which is now contiguous) to populate the listbox.&lt;/p&gt;
&lt;p&gt;It works but doesn&#039;t feel right...any views?&lt;/p&gt;
&lt;p&gt;D&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;Load table (on sheet) in Variant, pass variant to listbox. Then when filtering is needed, create extra variant array that holds the filtered items and pass that into the listbox. Very fast!&#8221;</p>
<p>I&#8217;ve tried this and can&#8217;t seem to get it to work&#8230;.</p>
<p>I think the problem is that the variant array represents a non-contiguous group of cells (ie the filtered list).  So when filtering on ItemA (of which there are 4 in the list) only one appears in the list box.</p>
<p>I&#8217;ve developed a work around which involves copying the filtered list (ie visible cells) to another sheet and then using this list (which is now contiguous) to populate the listbox.</p>
<p>It works but doesn&#8217;t feel right&#8230;any views?</p>
<p>D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38053</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Wed, 18 Feb 2009 15:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38053</guid>
		<description>&lt;p&gt;Jan Karel -&lt;/p&gt;
&lt;p&gt;I use pretty much the same approach. Fast to implement, fast to run.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Jan Karel -</p>
<p>I use pretty much the same approach. Fast to implement, fast to run.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Karel Pieterse</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38026</link>
		<dc:creator>Jan Karel Pieterse</dc:creator>
		<pubDate>Tue, 17 Feb 2009 18:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38026</guid>
		<description>&lt;p&gt;Thanks for all the tips guys, keep em coming!&lt;br&gt;
My current method is:&lt;/p&gt;
&lt;p&gt;Load table (on sheet) in Variant, pass variant to listbox. Then when filtering is needed, create extra variant array that holds the filtered items and pass that into the listbox. Very fast!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for all the tips guys, keep em coming!<br />
My current method is:</p>
<p>Load table (on sheet) in Variant, pass variant to listbox. Then when filtering is needed, create extra variant array that holds the filtered items and pass that into the listbox. Very fast!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sam</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38025</link>
		<dc:creator>sam</dc:creator>
		<pubDate>Tue, 17 Feb 2009 18:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38025</guid>
		<description>&lt;p&gt;I use a Dynamic name(s) for the column(s) that I want to load in a Combobox/Listbox.&lt;br&gt;
On the Properties - Rowsource/ListFillRange - I type the name of the Range&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I use a Dynamic name(s) for the column(s) that I want to load in a Combobox/Listbox.<br />
On the Properties &#8211; Rowsource/ListFillRange &#8211; I type the name of the Range</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Finch</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38021</link>
		<dc:creator>Finch</dc:creator>
		<pubDate>Tue, 17 Feb 2009 16:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38021</guid>
		<description>&lt;p&gt;Reading this blog for some time now, but this is my first reply. I hope it&#039;s useful.&lt;/p&gt;
&lt;p&gt;I had a similary problem. In my problem the data that needs to be put in the listbox also resides in a worksheet. I did the following:&lt;br&gt;
Put the range of the listbox items in a variant variable and passed them to the list property of the listbox all in once. (like keepITcool stated).&lt;/p&gt;
&lt;p&gt;To filter the list in the listbox, I used standard Excel filter options (autofilter) to filter the list on the worksheet. In a next step I copied the filtered rows (using specialcells(xlcelltypevisible)) to a new worksheet. This new sheet (or another range on the data sheet-if you want to skip a sheet) now holds the filtered items with no blank lines. This contiguous range can be put in a variant variable, and populate the listbox as described above very quickly. &lt;/p&gt;
&lt;p&gt;I&#039; m aware this method involves some extra steps, but the data is always addressed in block, and not on an item level.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Reading this blog for some time now, but this is my first reply. I hope it&#8217;s useful.</p>
<p>I had a similary problem. In my problem the data that needs to be put in the listbox also resides in a worksheet. I did the following:<br />
Put the range of the listbox items in a variant variable and passed them to the list property of the listbox all in once. (like keepITcool stated).</p>
<p>To filter the list in the listbox, I used standard Excel filter options (autofilter) to filter the list on the worksheet. In a next step I copied the filtered rows (using specialcells(xlcelltypevisible)) to a new worksheet. This new sheet (or another range on the data sheet-if you want to skip a sheet) now holds the filtered items with no blank lines. This contiguous range can be put in a variant variable, and populate the listbox as described above very quickly. </p>
<p>I&#8217; m aware this method involves some extra steps, but the data is always addressed in block, and not on an item level.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ross</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38019</link>
		<dc:creator>Ross</dc:creator>
		<pubDate>Tue, 17 Feb 2009 16:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38019</guid>
		<description>&lt;p&gt;pass the filter options to a worksheet, and then load the list box from the results, that&#039;s how I&#039;ve done it before.&lt;/p&gt;
&lt;p&gt;Alex,&lt;br&gt;
I believe that Bubble Sorts are quite slow in VBA.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>pass the filter options to a worksheet, and then load the list box from the results, that&#8217;s how I&#8217;ve done it before.</p>
<p>Alex,<br />
I believe that Bubble Sorts are quite slow in VBA.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Karel Pieterse</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/02/17/my-own-euler-problem/#comment-38018</link>
		<dc:creator>Jan Karel Pieterse</dc:creator>
		<pubDate>Tue, 17 Feb 2009 16:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=2103#comment-38018</guid>
		<description>&lt;p&gt;OK, I cracked it.&lt;/p&gt;
&lt;p&gt;I used to have a filtering routine (inside a loop which does all rows) with a test for validity that looked 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;&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; LCase(Table(lRow, 1)) &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; &amp; LCase(tbxSearchArticle1.Value) &amp; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; _&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; LCase(Table(lRow, 2)) &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; &amp; LCase(tbxSearchArticle2.Value) &amp; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; _&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; LCase(Table(lRow, 3)) &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; &amp; LCase(tbxSearchArticle3.Value) &amp; &lt;span class=&quot;st0&quot;&gt;&quot;*&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I decided to move the calls to the controls out of the loop and use variables. Also I decided to use the module level variable mvTable, rather than the property calls to the Table property Get methods. Finally instead of using Like, I use Instr. So my test changed to:&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;&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; (InStr(LCase(mvTable(lRow, 1)), sFilter1) * Len(sFilter1) + _&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; InStr(LCase(mvTable(lRow, 2)), sFilter2) * Len(sFilter2) + _&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; InStr(LCase(mvTable(lRow, 3)), sFilter3) * Len(sFilter3)) &gt; 0 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Also I used the tip KeepItCool gave to place the array into the listbox directly, which saved me another 0.2 secs.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>OK, I cracked it.</p>
<p>I used to have a filtering routine (inside a loop which does all rows) with a test for validity that looked like this:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> LCase(Table(lRow, 1)) <span class="kw1">Like</span> <span class="st0">&#8220;*&#8221;</span> &amp;amp; LCase(tbxSearchArticle1.Value) &amp;amp; <span class="st0">&#8220;*&#8221;</span> _<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">And</span> LCase(Table(lRow, 2)) <span class="kw1">Like</span> <span class="st0">&#8220;*&#8221;</span> &amp;amp; LCase(tbxSearchArticle2.Value) &amp;amp; <span class="st0">&#8220;*&#8221;</span> _<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">And</span> LCase(Table(lRow, 3)) <span class="kw1">Like</span> <span class="st0">&#8220;*&#8221;</span> &amp;amp; LCase(tbxSearchArticle3.Value) &amp;amp; <span class="st0">&#8220;*&#8221;</span> <span class="kw1">Then</span></div>
</div>
<p>I decided to move the calls to the controls out of the loop and use variables. Also I decided to use the module level variable mvTable, rather than the property calls to the Table property Get methods. Finally instead of using Like, I use Instr. So my test changed to:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> (InStr(LCase(mvTable(lRow, 1)), sFilter1) * Len(sFilter1) + _<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InStr(LCase(mvTable(lRow, 2)), sFilter2) * Len(sFilter2) + _<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InStr(LCase(mvTable(lRow, 3)), sFilter3) * Len(sFilter3)) &amp;gt; 0 <span class="kw1">Then</span></div>
</div>
<p>Also I used the tip KeepItCool gave to place the array into the listbox directly, which saved me another 0.2 secs.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

