<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Select Adjacent</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: zach</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-39072</link>
		<dc:creator>zach</dc:creator>
		<pubDate>Tue, 21 Apr 2009 22:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-39072</guid>
		<description>&lt;p&gt;This version extends the range to the longer of the column immediately left or right.  It also makes sure there&#039;s a cell directly below the cell to the left or right to make sure the xlDown doesn&#039;t return the last row in the worksheet when it&#039;s blank.&lt;/p&gt;
&lt;p&gt;The second version does the same with rows, extending them rightward.&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; SelectAdjacentCol()&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lRows &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Resume&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(0, -1)) &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(1, -1)) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; _&lt;br&gt;
&#160; &#160; &#160; &#160; lRows = Range(Selection.Offset(0, -1), Selection.Offset(0, -1).&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt;(xlDown)).Cells.Count&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(0, 1)) &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(1, 1)) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; _&lt;br&gt;
&#160; &#160; &#160; &#160; lRows = Application.WorksheetFunction.Max(lRows, Range(Selection.Offset(0, 1), Selection.Offset(0, 1).&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt;(xlDown)).Cells.Count)&lt;br&gt;
&lt;br&gt;
&#160; &#160; Selection.Resize(lRows).&lt;span class=&quot;kw1&quot;&gt;Select&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; SelectAdjacentRow()&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lRows &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Resume&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(-1, 0)) &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(-1, 1)) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; _&lt;br&gt;
&#160; &#160; &#160; &#160; lRows = Range(Selection.Offset(-1, 0), Selection.Offset(-1, 0).&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt;(xlToRight)).Cells.Count&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(1, 0)) &lt;span class=&quot;kw1&quot;&gt;And&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; IsEmpty(Selection.Offset(1, 1)) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; _&lt;br&gt;
&#160; &#160; &#160; &#160; lRows = Application.WorksheetFunction.Max(lRows, Range(Selection.Offset(1, 0), Selection.Offset(1, 0).&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt;(xlToRight)).Cells.Count)&lt;br&gt;
&lt;br&gt;
&#160; &#160; Selection.Resize(1, lRows).&lt;span class=&quot;kw1&quot;&gt;Select&lt;/span&gt;&lt;br&gt;
&#160; &#160;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>This version extends the range to the longer of the column immediately left or right.  It also makes sure there&#8217;s a cell directly below the cell to the left or right to make sure the xlDown doesn&#8217;t return the last row in the worksheet when it&#8217;s blank.</p>
<p>The second version does the same with rows, extending them rightward.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> SelectAdjacentCol()<br />
<span class="kw1">Dim</span> lRows <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span class="kw1">On</span> <span class="kw1">Error</span> <span class="kw1">Resume</span> <span class="kw1">Next</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(0, -1)) <span class="kw1">And</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(1, -1)) <span class="kw1">Then</span> _<br />
&nbsp; &nbsp; &nbsp; &nbsp; lRows = Range(Selection.Offset(0, -1), Selection.Offset(0, -1).<span class="kw1">End</span>(xlDown)).Cells.Count<br />
&nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(0, 1)) <span class="kw1">And</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(1, 1)) <span class="kw1">Then</span> _<br />
&nbsp; &nbsp; &nbsp; &nbsp; lRows = Application.WorksheetFunction.Max(lRows, Range(Selection.Offset(0, 1), Selection.Offset(0, 1).<span class="kw1">End</span>(xlDown)).Cells.Count)</p>
<p>&nbsp; &nbsp; Selection.Resize(lRows).<span class="kw1">Select</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="kw1">End</span> <span class="kw1">Sub</span></p>
<p>
<span class="kw1">Sub</span> SelectAdjacentRow()<br />
<span class="kw1">Dim</span> lRows <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; <span class="kw1">On</span> <span class="kw1">Error</span> <span class="kw1">Resume</span> <span class="kw1">Next</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(-1, 0)) <span class="kw1">And</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(-1, 1)) <span class="kw1">Then</span> _<br />
&nbsp; &nbsp; &nbsp; &nbsp; lRows = Range(Selection.Offset(-1, 0), Selection.Offset(-1, 0).<span class="kw1">End</span>(xlToRight)).Cells.Count<br />
&nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(1, 0)) <span class="kw1">And</span> <span class="kw1">Not</span> IsEmpty(Selection.Offset(1, 1)) <span class="kw1">Then</span> _<br />
&nbsp; &nbsp; &nbsp; &nbsp; lRows = Application.WorksheetFunction.Max(lRows, Range(Selection.Offset(1, 0), Selection.Offset(1, 0).<span class="kw1">End</span>(xlToRight)).Cells.Count)</p>
<p>&nbsp; &nbsp; Selection.Resize(1, lRows).<span class="kw1">Select</span><br />
&nbsp; &nbsp;<br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dion</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-29692</link>
		<dc:creator>Dion</dc:creator>
		<pubDate>Wed, 02 Jan 2008 05:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-29692</guid>
		<description>&lt;p&gt;Awesome, thanks.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Awesome, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-29688</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Tue, 01 Jan 2008 17:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-29688</guid>
		<description>&lt;p&gt;Dion:  It doesn&#039;t fill the formula down, it just selects the cells.  After the cells are selected, press Ctl+D to fill down.  Or if you want to adjust the macro, after the Selection.Resize line, put&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container text default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;text codecolorer&quot;&gt;Selection.FillDown&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Yes, Personal.xls is where I have mine.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dion:  It doesn&#8217;t fill the formula down, it just selects the cells.  After the cells are selected, press Ctl+D to fill down.  Or if you want to adjust the macro, after the Selection.Resize line, put</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container text default">
<div style="white-space: nowrap;" class="text codecolorer">Selection.FillDown</div>
</div>
<p>Yes, Personal.xls is where I have mine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dion</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-29677</link>
		<dc:creator>Dion</dc:creator>
		<pubDate>Mon, 31 Dec 2007 18:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-29677</guid>
		<description>&lt;p&gt;I&#039;ve pasted all three pieces of code in a standard module, saved and reopened the file. Now when I reopen the file and use the shortcut, it only selects the cells and does not fill the formula. Can you help me what might be causing troubles. &lt;/p&gt;
&lt;p&gt;Secondly, if I want this to be available in all the excel files do I just paste the code in Personal.xls?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;ve pasted all three pieces of code in a standard module, saved and reopened the file. Now when I reopen the file and use the shortcut, it only selects the cells and does not fill the formula. Can you help me what might be causing troubles. </p>
<p>Secondly, if I want this to be available in all the excel files do I just paste the code in Personal.xls?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-29440</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Sun, 16 Dec 2007 22:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-29440</guid>
		<description>&lt;p&gt;The easiest way to select cells B2:B19 is to do the following:&lt;/p&gt;
&lt;p&gt;Go to A2&lt;br&gt;
CTRL-DOWN&lt;br&gt;
RIGHT&lt;br&gt;
CTRL-SHIFT-UP&lt;/p&gt;
&lt;p&gt;Use it all the time.  It always freaks people out who watch you when you do it quickly...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The easiest way to select cells B2:B19 is to do the following:</p>
<p>Go to A2<br />
CTRL-DOWN<br />
RIGHT<br />
CTRL-SHIFT-UP</p>
<p>Use it all the time.  It always freaks people out who watch you when you do it quickly&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerry Gluck</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-29024</link>
		<dc:creator>Jerry Gluck</dc:creator>
		<pubDate>Thu, 29 Nov 2007 01:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-29024</guid>
		<description>&lt;p&gt;Using the original sub as a starting point, I fumbled my way thru VBA to create a modification that allows the selection can be anywhere to the right or left of the column to be operated upon. Simply put, it calculates the required offset, then selects the range. Seems to work OK, but does anyone see any pitfalls? I have no need for a keyboard shortcut, but I do have the need to do formula fill-downs.  However, if some of the cells in the target range are not populated, then it stops. In that event I have another sub (ActivateWhatever -- not sure where I got it from) that deals with this. Of course sometimes it goes far beyond the range of interest,&lt;/p&gt;
&lt;p&gt;Sub SelectTargetCol()&lt;br&gt;
       Dim rAdjacent As Range&lt;br&gt;
       Dim SetOff As Integer&lt;br&gt;
Set TRange = Application.InputBox(Prompt:=&quot;WhichColumn?&quot;, Type:=8)&lt;br&gt;
SetOff = ActiveCell.Column - TRange.Column&lt;br&gt;
    If TypeName(Selection) = &quot;Range&quot; Then&lt;br&gt;
            If Selection.Cells.Count = 1 Then&lt;br&gt;
                If Not IsEmpty(Selection.Offset(0, -SetOff).Value) Then&lt;br&gt;
                    With Selection.Offset(0, -SetOff)&lt;br&gt;
                       Set rAdjacent = .Parent.Range(.Cells(1), .End(xlDown))&lt;br&gt;
                    End With&lt;br&gt;
                    Selection.Resize(rAdjacent.Cells.Count).Select&lt;br&gt;
                End If&lt;br&gt;
            End If&lt;br&gt;
    End If&lt;br&gt;
End Sub&lt;/p&gt;
&lt;p&gt;Sub ActivateWherever()&lt;br&gt;
&#039;this identifies the last used row anywhere on the sheet &amp; allows you to specify where selection starts&lt;br&gt;
Dim Last As Double, Where As Double&lt;br&gt;
Where = InputBox(Prompt:=&quot;Which row?&quot;)&lt;br&gt;
Last = Cells.Find(What:=&quot;*&quot;, After:=[a1], _&lt;br&gt;
                    SearchOrder:=xlByRows, _&lt;br&gt;
                    SearchDirection:=xlPrevious).Row&lt;br&gt;
Range((Cells(Where, ActiveCell.Column)), Cells(Last, ActiveCell.Column)).Select&lt;br&gt;
End Sub&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Using the original sub as a starting point, I fumbled my way thru VBA to create a modification that allows the selection can be anywhere to the right or left of the column to be operated upon. Simply put, it calculates the required offset, then selects the range. Seems to work OK, but does anyone see any pitfalls? I have no need for a keyboard shortcut, but I do have the need to do formula fill-downs.  However, if some of the cells in the target range are not populated, then it stops. In that event I have another sub (ActivateWhatever &#8212; not sure where I got it from) that deals with this. Of course sometimes it goes far beyond the range of interest,</p>
<p>Sub SelectTargetCol()<br />
       Dim rAdjacent As Range<br />
       Dim SetOff As Integer<br />
Set TRange = Application.InputBox(Prompt:=&#8221;WhichColumn?&#8221;, Type:=8)<br />
SetOff = ActiveCell.Column &#8211; TRange.Column<br />
    If TypeName(Selection) = &#8220;Range&#8221; Then<br />
            If Selection.Cells.Count = 1 Then<br />
                If Not IsEmpty(Selection.Offset(0, -SetOff).Value) Then<br />
                    With Selection.Offset(0, -SetOff)<br />
                       Set rAdjacent = .Parent.Range(.Cells(1), .End(xlDown))<br />
                    End With<br />
                    Selection.Resize(rAdjacent.Cells.Count).Select<br />
                End If<br />
            End If<br />
    End If<br />
End Sub</p>
<p>Sub ActivateWherever()<br />
&#8216;this identifies the last used row anywhere on the sheet &amp; allows you to specify where selection starts<br />
Dim Last As Double, Where As Double<br />
Where = InputBox(Prompt:=&#8221;Which row?&#8221;)<br />
Last = Cells.Find(What:=&#8221;*&#8221;, After:=[a1], _<br />
                    SearchOrder:=xlByRows, _<br />
                    SearchDirection:=xlPrevious).Row<br />
Range((Cells(Where, ActiveCell.Column)), Cells(Last, ActiveCell.Column)).Select<br />
End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-28944</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Mon, 26 Nov 2007 21:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-28944</guid>
		<description>&lt;p&gt;CY:  &lt;a href=&quot;http://www.dailydoseofexcel.com/archives/2006/06/12/analyzing-vendor-discounts/#comment-28943&quot; rel=&quot;nofollow&quot;&gt;http://www.dailydoseofexcel.com/archives/2006/06/12/analyzing-vendor-discounts/#comment-28943&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;fzz: re the mouse: you are correct.  I thought about including right side columns and above and below rows, but I&#039;ve never needed them.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>CY:  <a href="http://www.dailydoseofexcel.com/archives/2006/06/12/analyzing-vendor-discounts/#comment-28943" rel="nofollow">http://www.dailydoseofexcel.com/archives/2006/06/12/analyzing-vendor-discounts/#comment-28943</a></p>
<p>fzz: re the mouse: you are correct.  I thought about including right side columns and above and below rows, but I&#8217;ve never needed them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fzz</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-28941</link>
		<dc:creator>fzz</dc:creator>
		<pubDate>Mon, 26 Nov 2007 19:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-28941</guid>
		<description>&lt;p&gt;I suppose double-clicking the fill handle doesn&#039;t count as simple since it involves the mouse.&lt;/p&gt;
&lt;p&gt;FWIW,&lt;/p&gt;
&lt;p&gt;^C&lt;br&gt;
+{left}&lt;br&gt;
{tab}&lt;br&gt;
+^{down}&lt;br&gt;
{tab}&lt;br&gt;
+{right}&lt;br&gt;
^V&lt;/p&gt;
&lt;p&gt;Also, FWIW, why not allow the adjacent range to be a column to the right, rows above or below, or both rows and columns bounding a region? Something like&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; foo()&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; a &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range, r &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, j &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;TypeOf&lt;/span&gt; Selection &lt;span class=&quot;kw1&quot;&gt;Is&lt;/span&gt; Range &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Selection.Cells.Count &#062; 1 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; a = ActiveCell&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; r = a.CurrentRegion&lt;br&gt;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt; Application.WorksheetFunction&lt;br&gt;
&#160; &#160; i = .CountA(Intersect(r, a.EntireColumn))&lt;br&gt;
&#160; &#160; j = .CountA(Intersect(r, a.EntireRow))&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; i &#062; j &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; Intersect(r, _&lt;br&gt;
&#160; &#160; &#160;a.EntireRow.Offset(0, a.Column - r.Column)).&lt;span class=&quot;kw1&quot;&gt;Select&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;ElseIf&lt;/span&gt; j &#062; i &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; Intersect(r, a.EntireColumn.Offset(a.Row - r.Row, 0)).&lt;span class=&quot;kw1&quot;&gt;Select&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Else&lt;/span&gt;&lt;br&gt;
&#160; &#160; Intersect(r, _&lt;br&gt;
&#160; &#160; &#160;r.Offset(a.Row - r.Row, a.Column - r.Column)).&lt;span class=&quot;kw1&quot;&gt;Select&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>I suppose double-clicking the fill handle doesn&#8217;t count as simple since it involves the mouse.</p>
<p>FWIW,</p>
<p>^C<br />
+{left}<br />
{tab}<br />
+^{down}<br />
{tab}<br />
+{right}<br />
^V</p>
<p>Also, FWIW, why not allow the adjacent range to be a column to the right, rows above or below, or both rows and columns bounding a region? Something like</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> foo()<br />
&nbsp; <span class="kw1">Dim</span> a <span class="kw1">As</span> Range, r <span class="kw1">As</span> Range<br />
&nbsp; <span class="kw1">Dim</span> i <span class="kw1">As</span> <span class="kw1">Long</span>, j <span class="kw1">As</span> <span class="kw1">Long</span></p>
<p>&nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> <span class="kw1">TypeOf</span> Selection <span class="kw1">Is</span> Range <span class="kw1">Then</span> <span class="kw1">Exit</span> <span class="kw1">Sub</span><br />
&nbsp; <span class="kw1">If</span> Selection.Cells.Count &amp;#62; 1 <span class="kw1">Then</span> <span class="kw1">Exit</span> <span class="kw1">Sub</span></p>
<p>&nbsp; <span class="kw1">Set</span> a = ActiveCell<br />
&nbsp; <span class="kw1">Set</span> r = a.CurrentRegion</p>
<p>&nbsp; <span class="kw1">With</span> Application.WorksheetFunction<br />
&nbsp; &nbsp; i = .CountA(Intersect(r, a.EntireColumn))<br />
&nbsp; &nbsp; j = .CountA(Intersect(r, a.EntireRow))<br />
&nbsp; <span class="kw1">End</span> <span class="kw1">With</span></p>
<p>&nbsp; <span class="kw1">If</span> i &amp;#62; j <span class="kw1">Then</span><br />
&nbsp; &nbsp; Intersect(r, _<br />
&nbsp; &nbsp; &nbsp;a.EntireRow.Offset(0, a.Column &#8211; r.Column)).<span class="kw1">Select</span><br />
&nbsp; <span class="kw1">ElseIf</span> j &amp;#62; i <span class="kw1">Then</span><br />
&nbsp; &nbsp; Intersect(r, a.EntireColumn.Offset(a.Row &#8211; r.Row, 0)).<span class="kw1">Select</span><br />
&nbsp; <span class="kw1">Else</span><br />
&nbsp; &nbsp; Intersect(r, _<br />
&nbsp; &nbsp; &nbsp;r.Offset(a.Row &#8211; r.Row, a.Column &#8211; r.Column)).<span class="kw1">Select</span><br />
&nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Youngblood</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-28940</link>
		<dc:creator>Chris Youngblood</dc:creator>
		<pubDate>Mon, 26 Nov 2007 18:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-28940</guid>
		<description>&lt;p&gt;Dick:&lt;/p&gt;
&lt;p&gt;I found your article on vendor discounts very interesting and useful.  Can you explain to a math dummy how you arrive to the 36% savings realized by taking advantage of the 2% available discount?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick:</p>
<p>I found your article on vendor discounts very interesting and useful.  Can you explain to a math dummy how you arrive to the 36% savings realized by taking advantage of the 2% available discount?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/11/25/select-adjacent/#comment-28939</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Mon, 26 Nov 2007 16:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1768#comment-28939</guid>
		<description>&lt;p&gt;MM: Because I&#039;m lazy.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>MM: Because I&#8217;m lazy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

