<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1178865674325918502</id><updated>2024-08-29T18:18:25.553-07:00</updated><title type='text'>Excel VBA Revisited</title><subtitle type='html'>Excel VBA tips and functions</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1178865674325918502.post-8976020671428662491</id><published>2015-02-19T07:02:00.003-08:00</published><updated>2015-02-19T08:11:20.034-08:00</updated><title type='text'>Split String By Comma</title><content type='html'>The following routine splits the comma-separated contents of an active cell into strings and prints each result &amp;nbsp;below the active cell. It will &lt;b&gt;overwrite &lt;/b&gt;the cells below the active cell.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Sub&lt;/span&gt; SplitByComma&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;

&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; arr &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Variant&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; row &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Integer&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; col &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Integer&lt;/span&gt;

row &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; ActiveCell&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;row
col &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; ActiveCell&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Column

arr &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; VBA&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;split&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;ActiveCell&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Value&lt;span style=&quot;color: #308080;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #1060b6;&quot;&gt;&quot;,&quot;&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;For&lt;/span&gt; i &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;To&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;UBound&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;arr&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
    Cells&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;row &lt;span style=&quot;color: #308080;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #308080;&quot;&gt;+&lt;/span&gt; i&lt;span style=&quot;color: #308080;&quot;&gt;,&lt;/span&gt; col&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;.&lt;/span&gt;Value &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Trim&lt;/span&gt;(arr&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #308080;&quot;&gt;))&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Next&lt;/span&gt; i

&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/8976020671428662491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://excelrevisited.blogspot.com/2015/02/split-string-by-comma.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/8976020671428662491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/8976020671428662491'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/2015/02/split-string-by-comma.html' title='Split String By Comma'/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1178865674325918502.post-1076555923761531877</id><published>2014-10-26T10:09:00.003-07:00</published><updated>2014-10-26T10:10:21.842-07:00</updated><title type='text'></title><content type='html'>&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.erikk.divtracker&quot;&gt;
  &lt;img alt=&quot;Get it on Google Play&quot;
       src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7nJs4kF3AzDzzpeHNqRRD_ZKKFpMgQM4EBQHzF_0sETDq5JGOyhV1FcO8VHJn35MEjd0GzCmFWQp2r3nuST-CslM33bZtdCT7wejOW_JgGWvm8Qfa9v0oRnsZUEsdET_Y-MIXVHtgNiYZ/s320/en_generic_rgb_wo_60.png&quot; /&gt;
&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/1076555923761531877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://excelrevisited.blogspot.com/2014/10/get-it-on-google-play.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/1076555923761531877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/1076555923761531877'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/2014/10/get-it-on-google-play.html' title=''/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7nJs4kF3AzDzzpeHNqRRD_ZKKFpMgQM4EBQHzF_0sETDq5JGOyhV1FcO8VHJn35MEjd0GzCmFWQp2r3nuST-CslM33bZtdCT7wejOW_JgGWvm8Qfa9v0oRnsZUEsdET_Y-MIXVHtgNiYZ/s72-c/en_generic_rgb_wo_60.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1178865674325918502.post-5582513088907826877</id><published>2013-02-15T12:23:00.000-08:00</published><updated>2014-03-24T22:13:22.711-07:00</updated><title type='text'>EndsWith and StartsWith For VBA</title><content type='html'>Here are listings for 2 functions that are missing in VBA: string starts with and string ends with. The functions are case-insensitive. They use a simple equality check which will probably make them unsuitable for non-ASCII text.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f6f8ff; color: #000020;&quot;&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt; EndsWith&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;str&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;,&lt;/span&gt; ending &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Boolean&lt;/span&gt;
     &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; endingLen &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Integer&lt;/span&gt;
     endingLen &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Len&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;ending&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
     EndsWith &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Right&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Trim&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;UCase&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;,&lt;/span&gt; endingLen&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;UCase&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;ending&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt;

&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt; StartsWith&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;str&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;,&lt;/span&gt; start &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Boolean&lt;/span&gt;
     &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; startLen &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Integer&lt;/span&gt;
     startLen &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Len&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;start&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
     StartsWith &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Left&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Trim&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;UCase&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;,&lt;/span&gt; startLen&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;UCase&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;start&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt;
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/5582513088907826877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/endswith.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/5582513088907826877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/5582513088907826877'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/endswith.html' title='EndsWith and StartsWith For VBA'/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1178865674325918502.post-5263287842388248003</id><published>2012-06-15T08:23:00.001-07:00</published><updated>2012-06-15T08:27:29.341-07:00</updated><title type='text'>Add Hyperlinks</title><content type='html'>The following procedure converts a url to a hyperlink in range:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; AddHyperlinks(rng As &lt;span style=&quot;color: blue;&quot;&gt;Range&lt;/span&gt;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; c &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Range&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;For Each&lt;/span&gt; c &lt;span style=&quot;color: blue;&quot;&gt;In&lt;/span&gt; rng&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;If&lt;/span&gt; StartsWith(c.Value, &quot;http&quot;) &lt;span style=&quot;color: blue;&quot;&gt;Then&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c.Hyperlinks.Add Anchor:=c, Address:=c.Value&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; End If&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;End Sub&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the &lt;a href=&quot;http://excelrevisited.blogspot.ca/2012/06/endswith.html&quot; target=&quot;_blank&quot;&gt;StartsWith&lt;/a&gt; function from the previous post.</content><link rel='replies' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/5263287842388248003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/add-hyperlinks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/5263287842388248003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/5263287842388248003'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/add-hyperlinks.html' title='Add Hyperlinks'/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1178865674325918502.post-9175756841192961492</id><published>2012-06-07T06:55:00.000-07:00</published><updated>2012-06-09T06:09:26.995-07:00</updated><title type='text'>Some Excel Range Functions</title><content type='html'>&lt;div&gt;
Here I will list code for some useful VBA functions that deal with an Excel range. I think the function descriptions are self-explanatory. &lt;/div&gt;
&lt;h3&gt;

Determine Last Row in a Range &lt;/h3&gt;
&lt;pre style=&quot;background: #f6f8ff; color: #000020;&quot;&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt; GetLastRow&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;rng &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; Range&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
    GetLastRow &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; rng&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Rows&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Count &lt;span style=&quot;color: #308080;&quot;&gt;+&lt;/span&gt; rng&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Row &lt;span style=&quot;color: #308080;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt;
&lt;/pre&gt;
&lt;h3&gt;

Return an Array of Row Numbers from a Range &lt;/h3&gt;
&lt;pre style=&quot;background: #f6f8ff; color: #000020;&quot;&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt; RowsFromRange&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;rng &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; Range&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;

&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; c &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; Range
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; i &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Integer&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; arr&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Integer&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;ReDim&lt;/span&gt; arr&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;rng&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Rows&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Count &lt;span style=&quot;color: #308080;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;

&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;For&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Each&lt;/span&gt; c &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;In&lt;/span&gt; rng&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Rows
    arr&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; c&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Row
    i &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; i &lt;span style=&quot;color: #308080;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;1&lt;/span&gt;
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Next&lt;/span&gt;

RowsFromRange &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; arr

&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/9175756841192961492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/determine-last-row-in-range.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/9175756841192961492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/9175756841192961492'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/determine-last-row-in-range.html' title='Some Excel Range Functions'/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1178865674325918502.post-6849944048090668603</id><published>2012-06-07T06:24:00.000-07:00</published><updated>2012-06-07T06:24:22.115-07:00</updated><title type='text'>Initialize VBA Array</title><content type='html'>Declare an array as Variant: &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;Dim arr as Variant &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Use the VBA &lt;strong&gt;Array&lt;/strong&gt; function to initialize the array: &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;arr = Array(154, 155, 156, 157)&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/6849944048090668603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/initialize-vba-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/6849944048090668603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/6849944048090668603'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/initialize-vba-array.html' title='Initialize VBA Array'/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1178865674325918502.post-5106482487009129677</id><published>2012-06-06T11:53:00.000-07:00</published><updated>2012-06-06T11:56:03.539-07:00</updated><title type='text'>Check if Worksheet Exists</title><content type='html'>This is a VBA function that checks if a Worksheet exists. It accepts a worksheet name as a parameter. It loops through worksheet names and stops if it finds the one you are looking for. &lt;br /&gt;
Otherwise, it goes through all of them and returns false. Also, it is case-insensitive.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f6f8ff; color: #000020;&quot;&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt; WorksheetExists&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;wsName &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Boolean&lt;/span&gt;
        &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; ws &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; Worksheet
        &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; ret &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Boolean&lt;/span&gt;
        ret &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0f4d75;&quot;&gt;False&lt;/span&gt;
        wsName &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;UCase&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;wsName&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;For&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Each&lt;/span&gt; ws &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;In&lt;/span&gt; ThisWorkbook&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;Sheets
            &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;If&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;UCase&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;(&lt;/span&gt;ws&lt;span style=&quot;color: #008c00;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: #308080;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; wsName &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Then&lt;/span&gt;
                ret &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0f4d75;&quot;&gt;True&lt;/span&gt;
                &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Exit&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;For&lt;/span&gt;
            &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;If&lt;/span&gt;
        &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Next&lt;/span&gt;
        WorksheetExists &lt;span style=&quot;color: #308080;&quot;&gt;=&lt;/span&gt; ret
&lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #200080; font-weight: bold;&quot;&gt;Function&lt;/span&gt;
&lt;/pre&gt;
&lt;div style=&#39;float:left; margin:2px 4px;&#39;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;ca-pub-8504512626105280&quot;;
/* 300x250, created 12/9/10 */
google_ad_slot = &quot;7115539031&quot;;
google_ad_width = 300;
google_ad_height = 250;
//--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://excelrevisited.blogspot.com/feeds/5106482487009129677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/check-if-worksheet-exists.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/5106482487009129677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1178865674325918502/posts/default/5106482487009129677'/><link rel='alternate' type='text/html' href='http://excelrevisited.blogspot.com/2012/06/check-if-worksheet-exists.html' title='Check if Worksheet Exists'/><author><name>Erik K.</name><uri>http://www.blogger.com/profile/04738667434492418561</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>