<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" 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/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Spreadsheet Budget and Consulting</title>
	
	<link>http://www.spreadsheetbudget.com</link>
	<description>Freeing Your Finances</description>
	<lastBuildDate>Thu, 14 Mar 2013 23:48:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SpreadsheetBudgetAndConsulting" /><feedburner:info uri="spreadsheetbudgetandconsulting" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>SUMIFS vs MATCH &amp; INDEX</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/g1mCTB8TR9o/</link>
		<comments>http://www.spreadsheetbudget.com/2013/03/14/sumifs-vs-match-index/#comments</comments>
		<pubDate>Thu, 14 Mar 2013 23:48:13 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[excel vba]]></category>
		<category><![CDATA[Time Card]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[excel functions]]></category>
		<category><![CDATA[time card]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=720</guid>
		<description><![CDATA[I have one Time Card template setup with SUMIFS (used for Excel 2007 and above templates) and one set up with MATCH/INDEX (used for my 2003 and below templates). I tested the calculation speeds for each in Excel 2013 (preview) on Windows 8. Here&#8217;s the VBA test code: Sub test() &#160; Dim dTimer As Double [...]]]></description>
				<content:encoded><![CDATA[<p>I have one Time Card template setup with SUMIFS (used for Excel 2007 and above templates) and one set up with MATCH/INDEX (used for my 2003 and below templates). I tested the calculation speeds for each in Excel 2013 (preview) on Windows 8.</p>
<p>Here&#8217;s the VBA test code:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #E56717; font-weight: bold;">Sub</span> test()
&nbsp;
    <span style="color: #151B8D; font-weight: bold;">Dim</span> dTimer <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Double</span>
    <span style="color: #151B8D; font-weight: bold;">Dim</span> iLoops <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>, iTotalIterations <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span>
    <span style="color: #151B8D; font-weight: bold;">Dim</span> wksStage <span style="color: #151B8D; font-weight: bold;">As</span> Worksheet
&nbsp;
    <span style="color: #151B8D; font-weight: bold;">Set</span> wksStage = ThisWorkbook.Worksheets(<span style="color: #800000;">&quot;Staging Area&quot;</span>)
    iTotalIterations = 1
    dTimer = Timer()
&nbsp;
    <span style="color: #8D38C9; font-weight: bold;">For</span> iLoops = 0 <span style="color: #8D38C9; font-weight: bold;">To</span> iTotalIterations
        wksStage.Calculate
    <span style="color: #8D38C9; font-weight: bold;">Next</span> iLoops
&nbsp;
    Debug.<span style="color: #151B8D; font-weight: bold;">Print</span> Timer() - dTimer
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span></pre></td></tr></table></div>

<p>And here&#8217;s the results (seconds):</p>
<table>
<tr>
<th>Iterations</th>
<th>SUMIFS</th>
<th>MATCH/INDEX</th>
</tr>
<tr>
<td>1</td>
<td>0.20</td>
<td>0.09</td>
</tr>
<tr>
<td>50</td>
<td>3.07</td>
<td>1.30</td>
</tr>
</table>
<p>So where do I go from here? I think I will keep the two separate templates for now, even though I could go to one. The reasons? </p>
<ul>
<li>
It is much easier to change SUMIFS than the complicated MATCH/INDEX functions.
</li>
<li>
I think I could introduce an error in the MATCH/INDEX functions more easily.
</li>
</ul>
<p>I will post the 2003 template for anyone that wishes faster calculation times, but it is pretty fast now, so I don&#8217;t know if that would be a huge issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/03/14/sumifs-vs-match-index/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/03/14/sumifs-vs-match-index/</feedburner:origLink></item>
		<item>
		<title>Coming TimeCard Software Updates</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/U2_hCE-xtok/</link>
		<comments>http://www.spreadsheetbudget.com/2013/03/13/coming-timecard-software-updates/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 23:33:57 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[Time Card]]></category>
		<category><![CDATA[time card]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=716</guid>
		<description><![CDATA[Just a quick update. I should be putting out the new Excel Time Card by the end of this week or early next week. This will be a big update. Including the following: Dashboard redesign (and Staging Area) easily change jobs on chart easily change settings on dashboard filter jobs on chart, e.g., you have [...]]]></description>
				<content:encoded><![CDATA[<p>Just a quick update. I should be putting out the new Excel Time Card by the end of this week or early next week. This will be a big update. Including the following:</p>
<ul>
<li>Dashboard redesign (and Staging Area)
<ul>
<li>easily change jobs on chart</li>
<li>easily change settings on dashboard</li>
<li>filter jobs on chart, e.g., you have TimeCard and TimeCard:Marketing, you can just put TimeCard* to include both on the same screen</li>
</ul>
<li>The template is now included in the program, so no need to download it</li>
</li>
<li>I&#8217;m testing out a new updater so you can have secure and smaller packaged updates.</li>
</ul>
<p>I have more plans for the future of the time card &#8211; I&#8217;ll let you know when I get close to finishing them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/03/13/coming-timecard-software-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/03/13/coming-timecard-software-updates/</feedburner:origLink></item>
		<item>
		<title>Excel Extensions</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/TXBG8lqTO6A/</link>
		<comments>http://www.spreadsheetbudget.com/2013/02/25/excel-extensions/#comments</comments>
		<pubDate>Mon, 25 Feb 2013 22:49:45 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[excel]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=710</guid>
		<description><![CDATA[Excel extensions extend the range object to use LinqTo2dArray (see also Codeplex). It also includes other extensions. RowsCount: Count total rows in all areas. Parse: Parse congruent range into an object by row-object arrays. This doesn&#8217;t necessarily need to be congruent, in the future I may make it so it skips to different areas in [...]]]></description>
				<content:encoded><![CDATA[<p>Excel extensions extend the range object to use <a href="http://www.spreadsheetbudget.com/2013/02/25/linqto2darray/">LinqTo2dArray</a> (see also <a href="http://linqto2darray.codeplex.com/">Codeplex</a>). It also includes other extensions.</p>
<ul>
<li>RowsCount: Count total rows in all areas.</li>
<li>Parse: Parse congruent range into an object by row-object arrays.
<ul>
<li>This doesn&#8217;t necessarily need to be congruent, in the future I may make it so it skips to different areas in the range.</li>
</ul>
</li>
<li>ToArray: Copies the elements of the 2D object array row wise to a new array of the specified element type and length.</li>
<li>To2dArray: Import Data From Excel as 2D zero-based Object Array</li>
<li>ToExcel: Export Data to Excel
<ul>
<li>Returns: Range where data was exported to.</li>
</ul>
</li>
</ul>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Data</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Diagnostics</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">NetOffice.ExcelApi</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">NetOffice.OfficeApi</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">NetOffice.ExcelApi.Enums</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">LinqTo2dArray</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> ExcelExtensions
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">class</span> RangeExtenstions
    <span style="color: #008000;">&#123;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Count total rows in all areas</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Working Range&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Total number of rows.&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 20120924&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">int</span> RowsCount<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>rng <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #6666cc; font-weight: bold;">int</span> iRowCount <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>Range rArea <span style="color: #0600FF; font-weight: bold;">in</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Areas</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    iRowCount <span style="color: #008000;">+=</span> rArea<span style="color: #008000;">.</span><span style="color: #0000FF;">Rows</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> iRowCount<span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">else</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span>
&nbsp;
       <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Parse congruent range into an object by row-object arrays.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;TSource&quot;&gt;Source type.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Function to convert&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;&lt;/returns&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> IEnumerable<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span> Parse<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, Func<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>, TSource<span style="color: #008000;">&gt;</span> conversion<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Areas</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&gt;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Congruent ranges only allowed.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Get2dArrayValue</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            IEnumerable<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span> cls <span style="color: #008000;">=</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>conversion<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> cls<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End Parse</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Copies the elements of the 2D object array row wise to a new array of the specified element type and length.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;T&quot;&gt;New array type.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Casting function of new type.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rowStart&quot;&gt;First row index to start.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;columnStart&quot;&gt;First column index to start.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rowCount&quot;&gt;Number of rows.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;columnCount&quot;&gt;Number of columns&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;One-dimensional array of type TSource&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt; Jon Nyman 20130205</span>
        <span style="color: #008080; font-style: italic;">/// Source http://msmvps.com/blogs/jon_skeet/archive/2011/01/02/reimplementing-linq-to-objects-part-24-toarray.aspx &lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> T<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> ToArray<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, Func<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">object</span>, T<span style="color: #008000;">&gt;</span> conversion
                                                , <span style="color: #6666cc; font-weight: bold;">int</span> rowStart, <span style="color: #6666cc; font-weight: bold;">int</span> columnStart, <span style="color: #6666cc; font-weight: bold;">int</span> rowCount, <span style="color: #6666cc; font-weight: bold;">int</span> columnCount<span style="color: #008000;">&#41;</span> 
        <span style="color: #008000;">&#123;</span>
            rowStart <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> columnStart <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> rowCount <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> columnCount <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Get2dArrayValue</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Make sure values are within range of array.</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>rowStart <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">||</span> columnStart <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">||</span> rowStart <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span> columnStart <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span>
                rowCount <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">||</span> rowCount <span style="color: #008000;">+</span> rowStart <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span> columnCount <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">||</span> columnCount <span style="color: #008000;">+</span> columnStart <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IndexOutOfRangeException</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Start or end values out of range (Parse)&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>conversion, rowStart, columnStart, rowCount, columnCount<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End ToArray</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Copies the elements of the 2D object array row wise to a new array of the specified element type and length.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;T&quot;&gt;New array type.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Casting function of new type.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;One-dimensional array of type TSource&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt; Jon Nyman 20130205</span>
        <span style="color: #008080; font-style: italic;">/// Source http://msmvps.com/blogs/jon_skeet/archive/2011/01/02/reimplementing-linq-to-objects-part-24-toarray.aspx &lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> T<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> ToArray<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, Func<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">object</span>, T<span style="color: #008000;">&gt;</span> conversion<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Get2dArrayValue</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>conversion<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End ToArray</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Import Data From Excel as 2D zero-based Object Array</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;AsValue&quot;&gt;True -&gt; .Value else .Value2 (Default)&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;2D object zero-based array&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 121023&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> To2dArray<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, <span style="color: #6666cc; font-weight: bold;">bool</span> AsValue<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
	        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Areas</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
		        <span style="color: #0600FF; font-weight: bold;">return</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArrayFromAreas</span><span style="color: #008000;">&#40;</span>AsValue<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
	        <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> oResult <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Get2dArrayValue</span><span style="color: #008000;">&#40;</span>AsValue<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
		    <span style="color: #6666cc; font-weight: bold;">int</span> iRowUpper <span style="color: #008000;">=</span> oResult<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		    <span style="color: #6666cc; font-weight: bold;">int</span> iColumnUpper <span style="color: #008000;">=</span> oResult<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> iRowLower <span style="color: #008000;">=</span> oResult<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLowerBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> iColumnLower <span style="color: #008000;">=</span> oResult<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLowerBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> oaResult <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>iRowUpper, iColumnUpper<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
		    <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> iRowLower<span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;=</span> iRowUpper<span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			    <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> j <span style="color: #008000;">=</span> iColumnLower<span style="color: #008000;">;</span> j <span style="color: #008000;">&lt;=</span> iColumnUpper<span style="color: #008000;">;</span> j<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
				    oaResult<span style="color: #008000;">&#91;</span>i <span style="color: #008000;">-</span> iRowLower, j <span style="color: #008000;">-</span> iColumnLower<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> oResult<span style="color: #008000;">&#91;</span>i, j<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
			    <span style="color: #008000;">&#125;</span>
		    <span style="color: #008000;">&#125;</span>
		    <span style="color: #0600FF; font-weight: bold;">return</span> oaResult<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End To2dArray</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Import Data From Excel as 2D zero-based Object Array with Value2</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;2D object zero-based array&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 121023&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> To2dArray<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">To2dArray</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End To2dArray</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Loop through areas of range and return single 2d zero-based object array.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;AsValue&quot;&gt;True -&gt; .Value else .Value2 (Default)&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;2D object zero-based array&lt;/returns&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> ToArrayFromAreas<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, <span style="color: #6666cc; font-weight: bold;">bool</span> AsValue<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            Range rArea <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> iColumnMax <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> Objects2D <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Areas</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> iAreaCount <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
            XlSheetVisibility xlVisible <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">ShowWorksheet</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>Range rArea_loopVariable <span style="color: #0600FF; font-weight: bold;">in</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Areas</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                rArea <span style="color: #008000;">=</span> rArea_loopVariable<span style="color: #008000;">;</span>
                Objects2D<span style="color: #008000;">&#91;</span>iAreaCount<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> rArea<span style="color: #008000;">.</span><span style="color: #0000FF;">Get2dArrayValue</span><span style="color: #008000;">&#40;</span>AsValue<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                iColumnMax <span style="color: #008000;">=</span> Math<span style="color: #008000;">.</span><span style="color: #0000FF;">Max</span><span style="color: #008000;">&#40;</span>iColumnMax, Objects2D<span style="color: #008000;">&#91;</span>iAreaCount<span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                iAreaCount <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> oaAreaResult <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>rng<span style="color: #008000;">.</span><span style="color: #0000FF;">RowsCount</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, iColumnMax<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> iRow <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i2DArraysIndex <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i2DArraysIndex <span style="color: #008000;">&lt;=</span> iAreaCount <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> i2DArraysIndex<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> iRowArea <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> iRowArea <span style="color: #008000;">&lt;=</span> Objects2D<span style="color: #008000;">&#91;</span>i2DArraysIndex<span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> iRowArea<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    iRow <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
                    <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> iColumnArea <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> iColumnArea <span style="color: #008000;">&lt;=</span> Objects2D<span style="color: #008000;">&#91;</span>i2DArraysIndex<span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> iColumnArea<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        oaAreaResult<span style="color: #008000;">&#91;</span>iRow, iColumnArea <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> Objects2D<span style="color: #008000;">&#91;</span>i2DArraysIndex<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>iRowArea, iColumnArea<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
            rng<span style="color: #008000;">.</span><span style="color: #0000FF;">RevertWorksheetVisibility</span><span style="color: #008000;">&#40;</span>xlVisible<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> oaAreaResult<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End ToArrayFromAreas</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Return 2d 0-based or 1-based object array from range</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;asValue&quot;&gt;True -&gt; .Value else .Value2 (Default)&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;2D object zero-based or one-based array&lt;/returns&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> Get2dArrayValue<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, <span style="color: #6666cc; font-weight: bold;">bool</span> asValue<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            XlSheetVisibility xlVisible <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">ShowWorksheet</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">object</span> resultValue <span style="color: #008000;">=</span> asValue <span style="color: #008000;">?</span> rng<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Value</span> <span style="color: #008000;">:</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Value2</span><span style="color: #008000;">;</span>
            rng<span style="color: #008000;">.</span><span style="color: #0000FF;">RevertWorksheetVisibility</span><span style="color: #008000;">&#40;</span>xlVisible<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>resultValue <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;&amp;</span> resultValue<span style="color: #008000;">.</span><span style="color: #0000FF;">GetType</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsArray</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span> resultValue<span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span><span style="color: #0600FF; font-weight: bold;">else</span><span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span> <span style="color: #008000;">&#123;</span> resultValue <span style="color: #008000;">&#125;</span> <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span> 
            <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End GetValueOfRange</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Return 2d 0-based or 1-based object array from range</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target range&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;2D object zero-based or one-based array&lt;/returns&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> Get2dArrayValue<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Get2dArrayValue</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Export Data to Excel</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target Range&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;data&quot;&gt;Data to export.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Range where data was exported to.&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 121023</span>
        <span style="color: #008080; font-style: italic;">/// 20130205 Convert to C#&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> Range ToExcel<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> data<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
	        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>rng <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">//Make sure range and 2D object match in size</span>
                Range rNew <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Resize</span><span style="color: #008000;">&#40;</span>data<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span>, data<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008080; font-style: italic;">//Send to Excel</span>
                XlSheetVisibility xlVisible <span style="color: #008000;">=</span> rNew<span style="color: #008000;">.</span><span style="color: #0000FF;">ShowWorksheet</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                rNew<span style="color: #008000;">.</span><span style="color: #0000FF;">Value2</span> <span style="color: #008000;">=</span> data<span style="color: #008000;">;</span>
                rNew<span style="color: #008000;">.</span><span style="color: #0000FF;">RevertWorksheetVisibility</span><span style="color: #008000;">&#40;</span>xlVisible<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> rNew<span style="color: #008000;">;</span>
	        <span style="color: #008000;">&#125;</span>
&nbsp;
	        <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">// End ToExcel</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Export Data to Excel</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rng&quot;&gt;Target Range&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;data&quot;&gt;Data to export.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Range where data was exported to.&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 121023</span>
        <span style="color: #008080; font-style: italic;">/// 20130205 Convert to C#&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> Range ToExcel<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> Range rng, <span style="color: #6666cc; font-weight: bold;">object</span> data<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>rng <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>data<span style="color: #008000;">.</span><span style="color: #0000FF;">GetType</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsArray</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>Array<span style="color: #008000;">&#41;</span>data<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Rank</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">ToExcel</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>data<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>
                    <span style="color: #0600FF; font-weight: bold;">else</span>
                    <span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">ToExcel</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>data<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>                    
                <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End If IsArray</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Make sure range and 2D object match in size</span>
                Range rNew <span style="color: #008000;">=</span> rng<span style="color: #008000;">.</span><span style="color: #0000FF;">Resize</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008080; font-style: italic;">//Send to Excel</span>
                XlSheetVisibility xlVisible <span style="color: #008000;">=</span> rNew<span style="color: #008000;">.</span><span style="color: #0000FF;">ShowWorksheet</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                rNew<span style="color: #008000;">.</span><span style="color: #0000FF;">Value2</span> <span style="color: #008000;">=</span> data<span style="color: #008000;">;</span>
                rNew<span style="color: #008000;">.</span><span style="color: #0000FF;">RevertWorksheetVisibility</span><span style="color: #008000;">&#40;</span>xlVisible<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> rNew<span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">// End ToExcel</span>
&nbsp;
    <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End class RangeExtenstions</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/02/25/excel-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/02/25/excel-extensions/</feedburner:origLink></item>
		<item>
		<title>LinqTo2dArray</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/XvpwpCcyX14/</link>
		<comments>http://www.spreadsheetbudget.com/2013/02/25/linqto2darray/#comments</comments>
		<pubDate>Mon, 25 Feb 2013 22:30:10 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[excel]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=694</guid>
		<description><![CDATA[LinqTo2dArray written in C# (to allow iteration over the rows). Also found on CodePlex. Parse will take a 2D Array (not necessarily zero based) and load it into a class. Parse 2D object array into a class row wise. Compose will create 2D object array from enumerable type. Copies the elements of the 2D object [...]]]></description>
				<content:encoded><![CDATA[<p>LinqTo2dArray written in C# (<a href="http://msdn.microsoft.com/en-us/library/vstudio/9k7k7cf0(v=vs.100).aspx">to allow iteration over the rows</a>). Also found on <a href="http://linqto2darray.codeplex.com/">CodePlex</a>.</p>
<ul>
<li>Parse will take a 2D Array (not necessarily zero based) and load it into a class. Parse 2D object array into a class row wise.</li>
<li>Compose will create 2D object array from enumerable type.</li>
<li>Copies the elements of the 2D object array row wise to a new array of the specified element type and length.</li>
</ul>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> LinqTo2dArray
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">class</span> Array2dExtensions
    <span style="color: #008000;">&#123;</span>
&nbsp;
       <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
       <span style="color: #008080; font-style: italic;">/// Parse 2D object array into a class row wise.</span>
       <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;TSource&quot;&gt;New enumerable type.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;array&quot;&gt;The two-dimensional Array to loop through.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Conversion function to TSource type.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rowStart&quot;&gt;First row index to start.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;columnStart&quot;&gt;First column index to start.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rowCount&quot;&gt;Number of rows.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;columnCount&quot;&gt;Number of columns&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;example&gt;</span>
        <span style="color: #008080; font-style: italic;">///  array.Parse(Of SaleOrder)(Function(o As Object()) New SaleOrder( _</span>
        <span style="color: #008080; font-style: italic;">///                                     If(TypeOf o(0) Is Double, Date.FromOADate(o(0)), #1/1/1900#) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(Not TypeOf o(1) Is Integer, o(1).ToString, &quot;&quot;) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(Not TypeOf o(2) Is Integer, o(2).ToString, &quot;&quot;) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(Not TypeOf o(3) Is Integer, o(3).ToString, &quot;&quot;) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(IsNumeric(o(4)) AndAlso Not TypeOf o(4) Is Integer, CInt(o(4)), 0) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(IsNumeric(o(5)) AndAlso Not TypeOf o(5) Is Integer, o(5), 0) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , o(6) + rowOffset _</span>
        <span style="color: #008080; font-style: italic;">///                                     ))</span>
        <span style="color: #008080; font-style: italic;">///   Note: Last index returns row number.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/example&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;exception cref=&quot;IndexOutOfRangeException&quot;&gt;Parameters are out of range of 2D array object.&lt;/exception&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Enumerable of TSource&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 130205&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> IEnumerable<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span> Parse<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array, Func<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>, TSource<span style="color: #008000;">&gt;</span> conversion
            , <span style="color: #6666cc; font-weight: bold;">int</span> rowStart, <span style="color: #6666cc; font-weight: bold;">int</span> columnStart, <span style="color: #6666cc; font-weight: bold;">int</span> rowCount, <span style="color: #6666cc; font-weight: bold;">int</span> columnCount<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Make sure values are within range of array.</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>rowStart <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">||</span> columnStart <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">||</span> rowStart <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span> columnStart <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span>
                rowCount <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">||</span> rowCount <span style="color: #008000;">+</span> rowStart <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span> columnCount <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">||</span> columnCount <span style="color: #008000;">+</span> columnStart <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IndexOutOfRangeException</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Start or end values out of range (Parse)&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Put 2D array values in a 1D array for conversion</span>
            <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> row <span style="color: #008000;">=</span> rowStart<span style="color: #008000;">;</span> row <span style="color: #008000;">&lt;</span> rowCount <span style="color: #008000;">+</span> rowStart<span style="color: #008000;">;</span> row<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> array1d <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>columnCount <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> column <span style="color: #008000;">=</span> columnStart<span style="color: #008000;">;</span> column <span style="color: #008000;">&lt;</span> columnCount <span style="color: #008000;">+</span> columnStart<span style="color: #008000;">;</span> column<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    array1d<span style="color: #008000;">&#91;</span>column <span style="color: #008000;">-</span> columnStart<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> array<span style="color: #008000;">&#91;</span>row, column<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #008080; font-style: italic;">//Add row number to the end of the 1D array.</span>
                array1d<span style="color: #008000;">&#91;</span>columnCount<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> row<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">yield</span> <span style="color: #0600FF; font-weight: bold;">return</span> conversion<span style="color: #008000;">&#40;</span>array1d<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End Parse</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Parse 2D object array into a class row wise.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;TSource&quot;&gt;New enumerable type.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;array&quot;&gt;The two-dimensional Array to loop through.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Conversion function to TSource type.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;example&gt;</span>
        <span style="color: #008080; font-style: italic;">///  array.Parse(Of SaleOrder)(Function(o As Object()) New SaleOrder( _</span>
        <span style="color: #008080; font-style: italic;">///                                     If(TypeOf o(0) Is Double, Date.FromOADate(o(0)), #1/1/1900#) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(Not TypeOf o(1) Is Integer, o(1).ToString, &quot;&quot;) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(Not TypeOf o(2) Is Integer, o(2).ToString, &quot;&quot;) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(Not TypeOf o(3) Is Integer, o(3).ToString, &quot;&quot;) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(IsNumeric(o(4)) AndAlso Not TypeOf o(4) Is Integer, CInt(o(4)), 0) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , If(IsNumeric(o(5)) AndAlso Not TypeOf o(5) Is Integer, o(5), 0) _</span>
        <span style="color: #008080; font-style: italic;">///                                     , o(6) + rowOffset _</span>
        <span style="color: #008080; font-style: italic;">///                                     ))</span>
        <span style="color: #008080; font-style: italic;">///   Note: Last index returns row number.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/example&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;exception cref=&quot;IndexOutOfRangeException&quot;&gt;Parameters are out of range of 2D array object.&lt;/exception&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Enumerable of TSource&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 130205&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> IEnumerable<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span> Parse<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array, Func<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span>, TSource<span style="color: #008000;">&gt;</span> conversion<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #6666cc; font-weight: bold;">int</span> rowStart<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLowerBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> colStart<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLowerBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> rowCount<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">-</span>rowStart<span style="color: #008000;">+</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> colCount<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">-</span>colStart<span style="color: #008000;">+</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>conversion, rowStart, colStart, rowCount, colCount<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span>
&nbsp;
         <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Copies the elements of the 2D object array row wise to a new array of the specified element type and length.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;T&quot;&gt;New array type.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;array&quot;&gt;The two-dimensional object array.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Casting function of new type.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rowStart&quot;&gt;First row index to start.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;columnStart&quot;&gt;First column index to start.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;rowCount&quot;&gt;Number of rows.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;columnCount&quot;&gt;Number of columns&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;One-dimensional array of type TSource&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt; Jon Nyman 20130205</span>
        <span style="color: #008080; font-style: italic;">/// Source http://msmvps.com/blogs/jon_skeet/archive/2011/01/02/reimplementing-linq-to-objects-part-24-toarray.aspx &lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> T<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> ToArray<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array, Func<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">object</span>, T<span style="color: #008000;">&gt;</span> conversion
                                                , <span style="color: #6666cc; font-weight: bold;">int</span> rowStart, <span style="color: #6666cc; font-weight: bold;">int</span> columnStart, <span style="color: #6666cc; font-weight: bold;">int</span> rowCount, <span style="color: #6666cc; font-weight: bold;">int</span> columnCount<span style="color: #008000;">&#41;</span> 
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//Make sure values are within range of array.</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>rowStart <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">||</span> columnStart <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">||</span> rowStart <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span> columnStart <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span>
                rowCount <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">||</span> rowCount <span style="color: #008000;">+</span> rowStart <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">||</span> columnCount <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">||</span> columnCount <span style="color: #008000;">+</span> columnStart <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span> <span style="color: #008000;">&gt;</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IndexOutOfRangeException</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Start or end values out of range (ToArray)&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Put 2D array values in a 1D array</span>
            T<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> array1d <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> T<span style="color: #008000;">&#91;</span>rowCount <span style="color: #008000;">*</span> columnCount<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> currentRow <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> row <span style="color: #008000;">=</span> rowStart<span style="color: #008000;">;</span> row <span style="color: #008000;">&lt;</span> rowCount <span style="color: #008000;">+</span> rowStart<span style="color: #008000;">;</span> row<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>                
                <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> column <span style="color: #008000;">=</span> columnStart<span style="color: #008000;">;</span> column <span style="color: #008000;">&lt;</span> columnCount <span style="color: #008000;">+</span> columnStart<span style="color: #008000;">;</span> column<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    currentRow <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
                    array1d<span style="color: #008000;">&#91;</span>currentRow<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> conversion<span style="color: #008000;">&#40;</span>array<span style="color: #008000;">&#91;</span>row, column<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>               
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> array1d<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End ToArray</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Copies the elements of the 2D object array row wise to a new array of the specified element type and length.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;T&quot;&gt;New array type.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;array&quot;&gt;The two-dimensional object array.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Casting function of new type.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;One-dimensional array of type TSource&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt; Jon Nyman 20130205</span>
        <span style="color: #008080; font-style: italic;">/// Source http://msmvps.com/blogs/jon_skeet/archive/2011/01/02/reimplementing-linq-to-objects-part-24-toarray.aspx &lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> T<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> ToArray<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array, Func<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">object</span>, T<span style="color: #008000;">&gt;</span> conversion<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> rowStart<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLowerBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> colStart<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLowerBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> rowCount<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">-</span>rowStart<span style="color: #008000;">+</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
            <span style="color: #6666cc; font-weight: bold;">int</span> colCount<span style="color: #008000;">=</span>array<span style="color: #008000;">.</span><span style="color: #0000FF;">GetUpperBound</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">-</span>colStart<span style="color: #008000;">+</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> array<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>conversion, rowStart, colStart, rowCount, colCount<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End ToArray</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Create 2D object array from enumerable type.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;TSource&quot;&gt;Enumerable type to convert.&lt;/typeparam&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;enumerator&quot;&gt;Enumerable to convert.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;conversion&quot;&gt;Logic to convert to object array.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;startIndex&quot;&gt;First index to start.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;count&quot;&gt;Number to convert.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;columnCount&quot;&gt;Number of columns to create.&lt;/param&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;example&gt;If clsItems.Count &gt; 0 Then</span>
        <span style="color: #008080; font-style: italic;">///           oaTimes = clsItems.Compose(Function(cls) _</span>
        <span style="color: #008080; font-style: italic;">///                {CType(clsItems.DateUsed.ToOADate, Object) _</span>
        <span style="color: #008080; font-style: italic;">///                 , cls.Name _</span>
        <span style="color: #008080; font-style: italic;">///                 , cls.ItemHoursForDay _</span>
        <span style="color: #008080; font-style: italic;">///                 , cls.ClockInTime}, 4)</span>
        <span style="color: #008080; font-style: italic;">///End If&lt;/example&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;2D Object Array&lt;/returns&gt;</span>
        <span style="color: #008080; font-style: italic;">/// &lt;remarks&gt;Jon Nyman 121109&lt;/remarks&gt;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> Compose<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> IEnumerable<span style="color: #008000;">&lt;</span>TSource<span style="color: #008000;">&gt;</span> enumerator, Func<span style="color: #008000;">&lt;</span>TSource, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&gt;</span> conversion
                                                                        ,  <span style="color: #6666cc; font-weight: bold;">int</span> columnCount<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">try</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #6666cc; font-weight: bold;">int</span> count <span style="color: #008000;">=</span> enumerator<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #6666cc; font-weight: bold;">int</span> row <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
                <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>,<span style="color: #008000;">&#93;</span> array2d <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>count, columnCount<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>TSource item <span style="color: #0600FF; font-weight: bold;">in</span> enumerator<span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    row <span style="color: #008000;">+=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
                    <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> array <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span>columnCount<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                    array <span style="color: #008000;">=</span> conversion<span style="color: #008000;">&#40;</span>item<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                    <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> j <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> j <span style="color: #008000;">&lt;=</span> columnCount <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> j<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        array2d<span style="color: #008000;">&#91;</span>row, j<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> array<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">return</span> array2d<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span><span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IndexOutOfRangeException</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IndexOutOfRangeException</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Incorrect number of columns. Compose.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span> <span style="color: #008080; font-style: italic;">//End Compose</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/02/25/linqto2darray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/02/25/linqto2darray/</feedburner:origLink></item>
		<item>
		<title>Attempted to read or write protected memory.</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/Rs91xKFZaPI/</link>
		<comments>http://www.spreadsheetbudget.com/2013/02/12/attempted-to-read-or-write-protected-memory/#comments</comments>
		<pubDate>Tue, 12 Feb 2013 23:18:41 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[Time Card]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[time card]]></category>
		<category><![CDATA[vb.net]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=697</guid>
		<description><![CDATA[I&#8217;ve been working on switching over to a &#8220;new&#8221; machine (more on that in a new post). In the process my time card program stopped working with the following error: System.AccessViolationException was unhandled Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Unfortunately this error doesn&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been working on switching over to a &#8220;new&#8221; machine (more on that in a new post). In the process my time card program stopped working with the following error:</p>
<blockquote><p>System.AccessViolationException was unhandled<br />
Message: Attempted to read or write protected memory.<br />
This is often an indication that other memory is corrupt.</p></blockquote>
<p>Unfortunately this error doesn&#8217;t show up until well after it occurs. So you need to make some educated guesses as to where it is coming from. So what I did is I just commented out code one at a time in the procedure where it was originating from. The code that was shown to be problematic was called from two different places &#8211; so the error occurred only from one of the branches but not the other. So that was a bit confusing. It was also confusing because it didn&#8217;t happen on my Windows XP computer, just on the &#8220;new&#8221; Windows 8 computer.</p>
<p>Eventually I figured out (with help from <a href="http://stackoverflow.com/q/8779557/632495">StackOverflow</a>) that it was caused by changing the values of my drop down list during the click event of the combo box.</p>
<p>To fix the problem, <a href="http://support.microsoft.com/kb/952544">Microsoft</a> recommends that you don&#8217;t change the values of the combo box during the event. So, I added a <a href="http://msdn.microsoft.com/en-us/library/h1c2h276(v=vs.85).aspx">timer component</a> to the form. The timer allows you to call a function in the future after completing other operations. I also use a timer in the Scribble Filter preview box when someone selects multiple lines on the form &#8211; so Excel doesn&#8217;t go crazy will I&#8217;m selected the corresponding rows.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/02/12/attempted-to-read-or-write-protected-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/02/12/attempted-to-read-or-write-protected-memory/</feedburner:origLink></item>
		<item>
		<title>RSS for Old Blog Posts</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/RNNTOykB86Y/</link>
		<comments>http://www.spreadsheetbudget.com/2013/01/16/rss-for-old-blog-posts/#comments</comments>
		<pubDate>Wed, 16 Jan 2013 07:00:01 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[useful tools]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=681</guid>
		<description><![CDATA[One of the nice to haves on my list is a way to read old blog posts via RSS. I&#8217;ve found that it is really easy to read someone&#8217;s old material on their blog if it is drip fed to me. Well, after a little searching on the internet I found Stream Spigot&#8217;s Feed Playback. [...]]]></description>
				<content:encoded><![CDATA[<p>One of the nice to haves on my list is a way to read old blog posts via RSS. I&#8217;ve found that it is really easy to read someone&#8217;s old material on their blog if it is drip fed to me. Well, after a little searching on the internet I found <a href="http://www.streamspigot.com/feed-playback/">Stream Spigot&#8217;s Feed Playback</a>. Now I can enjoy someone&#8217;s old posts without having to remember to go back every other day or once every week.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/01/16/rss-for-old-blog-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/01/16/rss-for-old-blog-posts/</feedburner:origLink></item>
		<item>
		<title>AdvancedFilter Wrapper Update &amp; Bug Fixes</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/Omn6rq0aC04/</link>
		<comments>http://www.spreadsheetbudget.com/2013/01/08/advancedfilter-wrapper-update-bug-fixes/#comments</comments>
		<pubDate>Tue, 08 Jan 2013 19:21:49 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[AdvancedFilter]]></category>
		<category><![CDATA[excel vba]]></category>
		<category><![CDATA[advancedfilter]]></category>
		<category><![CDATA[scribblefilter]]></category>
		<category><![CDATA[vb.net]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=687</guid>
		<description><![CDATA[Apparently there are some differences between the interaction between .NET and Excel vs VBA and Excel. In .NET I use a String matrix to set the value of the criteria range and it correctly puts formulas in where there should be formulas, etc. But when I do that with VBA it enters them as a [...]]]></description>
				<content:encoded><![CDATA[<p>Apparently there are some differences between the interaction between .NET and Excel vs VBA and Excel. In .NET I use a String matrix to set the value of the criteria range and it correctly puts formulas in where there should be formulas, etc. But when I do that with VBA it enters them as a text value, even after setting the range to &#8220;General&#8221; format. So, I needed to reenter the value as a formula after setting the range values. I&#8217;m sure I could have also just entered the values one by one also. But I elected to do the following as a work around:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #151B8D; font-weight: bold;">Set</span> rResult = ToExcel(rFilterLocation, saMatrix)
rResult.NumberFormat = <span style="color: #800000;">&quot;General&quot;</span>
rResult.Formula = rResult.Value2</pre></td></tr></table></div>

<p>I also added the ability to perform the searches with RPN notation instead of as a single string.</p>
<p>So</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="vb" style="font-family:monospace;">'sSearchString = <span style="color: #800000;">&quot;([Date]=8/7/2012||[Job]=&quot;</span><span style="color: #800000;">&quot;Scribble&quot;</span><span style="color: #800000;">&quot;)&amp;&amp;[Time]&gt;3&quot;</span></pre></td></tr></table></div>

<p>search string would look like this in a collection:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'Create search terms in order to filter (RPN style) Note that in a string search we do double &amp;&amp; || but
</span><span style="color: #008000;">'in RPN notation we use single &amp; | notation.
</span>colSearchString.Add <span style="color: #800000;">&quot;[Date]=8/7/2012&quot;</span>
colSearchString.Add <span style="color: #800000;">&quot;[Job]=&quot;</span><span style="color: #800000;">&quot;Scribble&quot;</span><span style="color: #800000;">&quot;&quot;</span>
colSearchString.Add <span style="color: #800000;">&quot;|&quot;</span>
colSearchString.Add <span style="color: #800000;">&quot;[Time]&gt;3&quot;</span>
colSearchString.Add <span style="color: #800000;">&quot;&amp;&quot;</span></pre></td></tr></table></div>

<p>See the SearchSample module for more details and other examples.</p>
<div id='wpdm_file_5' class='wpdm_file wpdm-only-button'><div class='cont'><div class='btn_outer'><div class='btn_outer_c' style=''><a class='btn_left  has-counter' rel='5' title='AdvancedFilter Wrapper Engine' href='http://www.spreadsheetbudget.com/?wpdmact=process&did=NS5ob3RsaW5r'  >AFW Engine</a><span class='btn_right counter'>130 downloads</span></div></div><div class='clear'></div></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/01/08/advancedfilter-wrapper-update-bug-fixes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/01/08/advancedfilter-wrapper-update-bug-fixes/</feedburner:origLink></item>
		<item>
		<title>Max Write to Excel (2003) in Array</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/QnqYNjTI5Ik/</link>
		<comments>http://www.spreadsheetbudget.com/2013/01/01/max-write-to-excel-2003-in-array/#comments</comments>
		<pubDate>Tue, 01 Jan 2013 07:00:33 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[excel vba]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=674</guid>
		<description><![CDATA[I normally don&#8217;t deal with very long strings. But I&#8217;m working on a project that requires storing a text file in Excel that I can later access (it would be nice just to embed it but Excel doesn&#8217;t like viruses &#8211; which makes me have to just store it in a worksheet). So what is [...]]]></description>
				<content:encoded><![CDATA[<p>I normally don&#8217;t deal with very long strings. But I&#8217;m working on a project that requires storing a text file in Excel that I can later access (it would be nice just to embed it but Excel doesn&#8217;t like viruses &#8211; which makes me have to just store it in a worksheet).</p>
<p>So what is the max string length in an array write to an Excel range?</p>
<p>911</p>
<p>Seems kind of random but that is the number. Raise that number to 912 and you&#8217;ll get an error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2013/01/01/max-write-to-excel-2003-in-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2013/01/01/max-write-to-excel-2003-in-array/</feedburner:origLink></item>
		<item>
		<title>AdvancedFilter Wrapper Engine for VBA Enthusiasts</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/GJVKXSTgDcs/</link>
		<comments>http://www.spreadsheetbudget.com/2012/12/18/advancedfilter-wrapper-engine-for-vba-enthusiasts/#comments</comments>
		<pubDate>Wed, 19 Dec 2012 01:35:18 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[AdvancedFilter]]></category>
		<category><![CDATA[excel vba]]></category>
		<category><![CDATA[Scribble Filter]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[advancedfilter]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[scribblefilter]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=649</guid>
		<description><![CDATA[A while back ago I promised to produce my engine for the advancedfilter wrapper. Well, at the prodding of Hugo I finally put it together. I took the code from my VB.NET project and converted it to VBA. Man, that reminds of why I love .NET so much! If you ever get a chance to [...]]]></description>
				<content:encoded><![CDATA[<p>A while back ago I promised to produce my engine for the advancedfilter wrapper. Well, at the prodding of <a href="http://blog.contextures.com/archives/2011/03/02/excel-autofilter-or-advanced-filter/#comment-43397">Hugo</a> I finally put it together. I took the code from my VB.NET project and converted it to VBA. Man, that reminds of why I love .NET so much! If you ever get a chance to learn .NET of VBA definitely take the opportunity. At first it is difficult but then it gets to the point where you don&#8217;t want to go back.</p>
<p>In the next few weeks I&#8217;ll go over how to use the Search class and its particulars. For anyone that uses it all I ask is that you credit me and that you spread the word about <a href="http://www.spreadsheetbudget.com/products/scribble-filter/">Scribble Filter</a>! If you find any bugs let me know and I&#8217;ll fix them.</p>
<p>Some things you should know:</p>
<p>4 files are needed:<br />
LogicRPNGenerator.bas<br />
Search.cls<br />
Stack.cls<br />
StandardCode.bas</p>
<p>The file <strong>SearchSample.bas</strong> shows a few examples. If you don&#8217;t specify your own temp worksheet then it will create one and then delete it after the Search class terminates. <strong>Anything on the temp worksheet will be deleted</strong>. Let me know what you think!</p>
<div id='wpdm_file_5' class='wpdm_file wpdm-only-button'><div class='cont'><div class='btn_outer'><div class='btn_outer_c' style=''><a class='btn_left  has-counter' rel='5' title='AdvancedFilter Wrapper Engine' href='http://www.spreadsheetbudget.com/?wpdmact=process&did=NS5ob3RsaW5r'  >AFW Engine</a><span class='btn_right counter'>130 downloads</span></div></div><div class='clear'></div></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2012/12/18/advancedfilter-wrapper-engine-for-vba-enthusiasts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2012/12/18/advancedfilter-wrapper-engine-for-vba-enthusiasts/</feedburner:origLink></item>
		<item>
		<title>Scribble Filter Features Video</title>
		<link>http://feedproxy.google.com/~r/SpreadsheetBudgetAndConsulting/~3/e0-N1zVFawM/</link>
		<comments>http://www.spreadsheetbudget.com/2012/12/12/scribble-filter-features-video/#comments</comments>
		<pubDate>Wed, 12 Dec 2012 07:00:49 +0000</pubDate>
		<dc:creator>Jon Nyman</dc:creator>
				<category><![CDATA[Scribble Filter]]></category>
		<category><![CDATA[advancedfilter]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[scribblefilter]]></category>

		<guid isPermaLink="false">http://www.spreadsheetbudget.com/?p=639</guid>
		<description><![CDATA[The scribble filter is a text wrapper for the Advanced Filter in Excel, making it easy to work with and adding new capabilities. Standard Excel 64-bit This video is a very quick look at what Scribble Filter can do. Topics Covered Select data source to be filtered @00:02 Select date range to be filtered @00:13 [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.spreadsheetbudget.com/products/scribble-filter/">The scribble filter is a text wrapper for the Advanced Filter in Excel, making it easy to work with and adding new capabilities.</a></p>
<div align="center">
<table align="center">
<tbody>
<tr>
<th>
<div style="padding-right: 2em;"><a title="Excel is typically installed with the 32-bit version.">Standard</a></div>
</th>
<th><a title="Excel installed with 64-bit version.">Excel 64-bit</a></th>
</tr>
<tr>
<td>
<div style="padding-right: 2em;"><div id='wpdm_file_1' class='wpdm_file wpdm-only-button'><div class='cont'><div class='btn_outer'><div class='btn_outer_c' style=''><a class='btn_left  has-counter' rel='1' title='Excel Scribble Filter Installer x86' href='http://www.spreadsheetbudget.com/?wpdmact=process&did=MS5ob3RsaW5r'  >x86 Trial</a><span class='btn_right counter'>160 downloads</span></div></div><div class='clear'></div></div></div></div>
</td>
<td><div id='wpdm_file_4' class='wpdm_file wpdm-only-button'><div class='cont'><div class='btn_outer'><div class='btn_outer_c' style=''><a class='btn_left  has-counter' rel='4' title='Excel Scribble Filter Installer x64' href='http://www.spreadsheetbudget.com/?wpdmact=process&did=NC5ob3RsaW5r'  >x64 Trial</a><span class='btn_right counter'>164 downloads</span></div></div><div class='clear'></div></div></div></td>
</tr>
</tbody>
</table>
</div>
<p>This video is a very quick look at what Scribble Filter can do.</p>
<div align="center"><iframe src="http://www.youtube.com/embed/iheMzcBI5Ws?rel=0" frameborder="0" width="640" height="480"></iframe></div>
<p><strong>Topics Covered</strong></p>
<ul>
<li>Select data source to be filtered @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=2s">00:02</a></li>
<li>Select date range to be filtered @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=13s">00:13</a></li>
<li>List of date ranges @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=14s">00:14</a></li>
<li>Select date header @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=16s">00:16</a></li>
<li>Auto suggestions @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=19s">00:19</a></li>
<li>Save query @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=22s">00:22</a></li>
<li>Preview data in a form @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=27s">00:27</a></li>
<li>Sort data in preview form @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=31s">00:31</a></li>
<li>Highlight data on worksheet from form @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=33s">00:33</a></li>
<li>Options for displaying filtered data @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=37s">00:37</a></li>
<li>Perform multiple filters with a single query @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=42s">00:42</a></li>
<li>Top 10% example with special functions @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=49s">00:49</a></li>
<li>Above average special function example @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=56s">00:56</a></li>
<li>Above average function using Excel function @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=68s">01:08</a></li>
<li>Excel table nomenclature @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=68s">01:08</a></li>
<li>Excel function with possible parameters listed @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=78s">01:18</a></li>
<li>Click on function name to open Excel function web page @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=88s">01:28</a></li>
<li>Credits @<a href="https://www.youtube.com/watch?v=iheMzcBI5Ws&amp;feature=player_detailpage#t=97s">01:37</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.spreadsheetbudget.com/2012/12/12/scribble-filter-features-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spreadsheetbudget.com/2012/12/12/scribble-filter-features-video/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

 Served from: www.spreadsheetbudget.com @ 2013-05-20 08:53:29 by W3 Total Cache -->
