<?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: Borders All Around</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:28:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Andrew</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29218</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Thu, 06 Dec 2007 07:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29218</guid>
		<description>&lt;p&gt;I came up with something similar to Andy. Not as well done though.&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; AddMultipleSelectionBorders()&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;span class=&quot;co1&quot;&gt;&#039;In case cells have no offset cells&lt;br&gt;
&lt;/span&gt; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rCell &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&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; TypeName(Selection) = &lt;span class=&quot;st0&quot;&gt;&quot;Range&quot;&lt;/span&gt; &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; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; rCell &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; Selection&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Intersect(rCell.Offset(-1), Selection) &lt;span class=&quot;kw1&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; rCell.Borders(xlEdgeTop).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Intersect(rCell.Offset(1), Selection) &lt;span class=&quot;kw1&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; rCell.Borders(xlEdgeBottom).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Intersect(rCell.Offset(, -1), Selection) &lt;span class=&quot;kw1&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; rCell.Borders(xlEdgeLeft).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Intersect(rCell.Offset(, 1), Selection) &lt;span class=&quot;kw1&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; rCell.Borders(xlEdgeRight).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; rCell&lt;br&gt;
&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;Goto&lt;/span&gt; 0&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 came up with something similar to Andy. Not as well done though.</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> AddMultipleSelectionBorders()<br />
&nbsp; &nbsp; <span class="kw1">On</span> <span class="kw1">Error</span> <span class="kw1">Resume</span> <span class="kw1">Next</span> <span class="co1">&#8216;In case cells have no offset cells<br />
</span> &nbsp; &nbsp;<span class="kw1">Dim</span> rCell <span class="kw1">As</span> Range</p>
<p>&nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> TypeName(Selection) = <span class="st0">&#8220;Range&#8221;</span> <span class="kw1">Then</span> <span class="kw1">Exit</span> <span class="kw1">Sub</span></p>
<p>&nbsp; &nbsp; <span class="kw1">For</span> <span class="kw1">Each</span> rCell <span class="kw1">In</span> Selection<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Intersect(rCell.Offset(-1), Selection) <span class="kw1">Is</span> <span class="kw1">Nothing</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rCell.Borders(xlEdgeTop).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Intersect(rCell.Offset(1), Selection) <span class="kw1">Is</span> <span class="kw1">Nothing</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rCell.Borders(xlEdgeBottom).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Intersect(rCell.Offset(, -1), Selection) <span class="kw1">Is</span> <span class="kw1">Nothing</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rCell.Borders(xlEdgeLeft).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Intersect(rCell.Offset(, 1), Selection) <span class="kw1">Is</span> <span class="kw1">Nothing</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rCell.Borders(xlEdgeRight).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">Next</span> rCell</p>
<p>&nbsp; &nbsp; <span class="kw1">On</span> <span class="kw1">Error</span> <span class="kw1">Goto</span> 0<br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: fzz</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29179</link>
		<dc:creator>fzz</dc:creator>
		<pubDate>Tue, 04 Dec 2007 22:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29179</guid>
		<description>&lt;p&gt;And my approach - put borders around all areas, then remove the unnecessary ones.&lt;/p&gt;
&lt;p&gt;&lt;code lang=&quot;vb&quot;&gt;&lt;br&gt;
Sub test()&lt;br&gt;
  Dim c As Range, s As Range&lt;br&gt;
  Dim nc As Long, nr As Long&lt;/code&gt;&lt;/p&gt;
&lt;code lang=&quot;vb&quot;&gt;
&lt;p&gt;  If TypeOf Selection Is Range Then Set s = Selection _&lt;br&gt;
   Else Exit Sub&lt;/p&gt;
&lt;p&gt;  nc = s.Parent.Cells.Columns.Count&lt;br&gt;
  nr = s.Parent.Cells.Rows.Count&lt;/p&gt;
&lt;p&gt;  s.BorderAround LineStyle:=xlContinuous, Weight:=xlThin&lt;/p&gt;
&lt;p&gt;  For Each c In s&lt;br&gt;
    If c.Row &gt; 1 Then _&lt;br&gt;
     If Not Intersect(c.Offset(-1, 0), s) Is Nothing Then _&lt;br&gt;
      c.Borders(xlEdgeTop).LineStyle = xlLineStyleNone&lt;/p&gt;
&lt;p&gt;    If c.Row  1 Then _&lt;br&gt;
     If Not Intersect(c.Offset(0, -1), s) Is Nothing Then _&lt;br&gt;
      c.Borders(xlEdgeLeft).LineStyle = xlLineStyleNone&lt;/p&gt;
&lt;p&gt;    If c.Column&lt;/p&gt;&lt;/code&gt;
&lt;p&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>And my approach &#8211; put borders around all areas, then remove the unnecessary ones.</p>
<p><div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br&gt;<br />
<span style="color: #E56717; font-weight: bold;">Sub</span> test()&lt;br&gt;<br />
&nbsp; <span style="color: #151B8D; font-weight: bold;">Dim</span> c <span style="color: #151B8D; font-weight: bold;">As</span> Range, s <span style="color: #151B8D; font-weight: bold;">As</span> Range&lt;br&gt;<br />
&nbsp; <span style="color: #151B8D; font-weight: bold;">Dim</span> nc <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span>, nr <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span></div></div>
</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;p&gt; &nbsp;<span style="color: #8D38C9; font-weight: bold;">If</span> <span style="color: #151B8D; font-weight: bold;">TypeOf</span> Selection <span style="color: #8D38C9; font-weight: bold;">Is</span> Range <span style="color: #8D38C9; font-weight: bold;">Then</span> <span style="color: #151B8D; font-weight: bold;">Set</span> s = Selection _&lt;br&gt;<br />
&nbsp; &nbsp;<span style="color: #8D38C9; font-weight: bold;">Else</span> <span style="color: #E56717; font-weight: bold;">Exit</span> Sub&lt;/p&gt;<br />
&lt;p&gt; &nbsp;nc = s.Parent.Cells.Columns.Count&lt;br&gt;<br />
&nbsp; nr = s.Parent.Cells.Rows.Count&lt;/p&gt;<br />
&lt;p&gt; &nbsp;s.BorderAround LineStyle:=xlContinuous, Weight:=xlThin&lt;/p&gt;<br />
&lt;p&gt; &nbsp;<span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> c <span style="color: #8D38C9; font-weight: bold;">In</span> s&lt;br&gt;<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> c.Row &amp;gt; 1 <span style="color: #8D38C9; font-weight: bold;">Then</span> _&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #8D38C9; font-weight: bold;">If</span> <span style="color: #8D38C9; font-weight: bold;">Not</span> Intersect(c.Offset(-1, 0), s) <span style="color: #8D38C9; font-weight: bold;">Is</span> <span style="color: #00C2FF; font-weight: bold;">Nothing</span> <span style="color: #8D38C9; font-weight: bold;">Then</span> _&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp; c.Borders(xlEdgeTop).LineStyle = xlLineStyleNone&lt;/p&gt;<br />
&lt;p&gt; &nbsp; &nbsp;<span style="color: #8D38C9; font-weight: bold;">If</span> c.Row &nbsp;1 <span style="color: #8D38C9; font-weight: bold;">Then</span> _&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #8D38C9; font-weight: bold;">If</span> <span style="color: #8D38C9; font-weight: bold;">Not</span> Intersect(c.Offset(0, -1), s) <span style="color: #8D38C9; font-weight: bold;">Is</span> <span style="color: #00C2FF; font-weight: bold;">Nothing</span> <span style="color: #8D38C9; font-weight: bold;">Then</span> _&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp; c.Borders(xlEdgeLeft).LineStyle = xlLineStyleNone&lt;/p&gt;<br />
&lt;p&gt; &nbsp; &nbsp;<span style="color: #8D38C9; font-weight: bold;">If</span> c.Column&lt;/p&gt;</div></div></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29178</link>
		<dc:creator>Zach</dc:creator>
		<pubDate>Tue, 04 Dec 2007 20:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29178</guid>
		<description>&lt;p&gt;My take would never be described as elegant, but it does have the advantage that I&#039;ll be able to figure out how it works without having to think too much.  It hurts sometimes.&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; bar()&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; r &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; r2 &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; btop &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; bbottom &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; bleft &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; bright &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Boolean&lt;/span&gt;&lt;br&gt;
&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; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; r &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; Selection.Cells&lt;br&gt;
&#160; &#160; &#160; &#160; btop = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; bbottom = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; bleft = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; bright = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; r2 &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; Selection.Cells&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; r2.Address = r.Offset(-1, 0).Address &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; btop = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; r2.Address = r.Offset(1, 0).Address &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; bbottom = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; r2.Address = r.Offset(0, -1).Address &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; bleft = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; r2.Address = r.Offset(0, 1).Address &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; bright = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; btop &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeTop).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; btop &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeTop).Weight = xlThin&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; bbottom &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeBottom).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; bbottom &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeBottom).Weight = xlThin&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; bright &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeRight).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; bright &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeRight).Weight = xlThin&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; bleft &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeLeft).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; bleft &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; r.Borders(xlEdgeLeft).Weight = xlThin&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&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>My take would never be described as elegant, but it does have the advantage that I&#8217;ll be able to figure out how it works without having to think too much.  It hurts sometimes.</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> bar()<br />
<span class="kw1">Dim</span> r <span class="kw1">As</span> Range<br />
<span class="kw1">Dim</span> r2 <span class="kw1">As</span> Range<br />
<span class="kw1">Dim</span> btop <span class="kw1">As</span> <span class="kw1">Boolean</span><br />
<span class="kw1">Dim</span> bbottom <span class="kw1">As</span> <span class="kw1">Boolean</span><br />
<span class="kw1">Dim</span> bleft <span class="kw1">As</span> <span class="kw1">Boolean</span><br />
<span class="kw1">Dim</span> bright <span class="kw1">As</span> <span class="kw1">Boolean</span></p>
<p>&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; <span class="kw1">For</span> <span class="kw1">Each</span> r <span class="kw1">In</span> Selection.Cells<br />
&nbsp; &nbsp; &nbsp; &nbsp; btop = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bbottom = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bleft = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bright = <span class="kw1">True</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">For</span> <span class="kw1">Each</span> r2 <span class="kw1">In</span> Selection.Cells<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> r2.Address = r.Offset(-1, 0).Address <span class="kw1">Then</span> btop = <span class="kw1">False</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> r2.Address = r.Offset(1, 0).Address <span class="kw1">Then</span> bbottom = <span class="kw1">False</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> r2.Address = r.Offset(0, -1).Address <span class="kw1">Then</span> bleft = <span class="kw1">False</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> r2.Address = r.Offset(0, 1).Address <span class="kw1">Then</span> bright = <span class="kw1">False</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Next</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> btop <span class="kw1">Then</span> r.Borders(xlEdgeTop).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> btop <span class="kw1">Then</span> r.Borders(xlEdgeTop).Weight = xlThin<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> bbottom <span class="kw1">Then</span> r.Borders(xlEdgeBottom).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> bbottom <span class="kw1">Then</span> r.Borders(xlEdgeBottom).Weight = xlThin<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> bright <span class="kw1">Then</span> r.Borders(xlEdgeRight).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> bright <span class="kw1">Then</span> r.Borders(xlEdgeRight).Weight = xlThin<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> bleft <span class="kw1">Then</span> r.Borders(xlEdgeLeft).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> bleft <span class="kw1">Then</span> r.Borders(xlEdgeLeft).Weight = xlThin<br />
&nbsp; &nbsp; <span class="kw1">Next</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29174</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 04 Dec 2007 17:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29174</guid>
		<description>&lt;p&gt;i had problems with the original macro getting stuck at:&lt;/p&gt;
&lt;p&gt;Dim tResult As CommonBorder&lt;/p&gt;
&lt;p&gt;andy pope&#039;s worked just fine... however, where in the macro is the line style stated (or, how do i change to a thicker line)&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>i had problems with the original macro getting stuck at:</p>
<p>Dim tResult As CommonBorder</p>
<p>andy pope&#8217;s worked just fine&#8230; however, where in the macro is the line style stated (or, how do i change to a thicker line)</p>
<p>thanks</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29172</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 04 Dec 2007 17:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29172</guid>
		<description>&lt;p&gt;I was going to suggest checking the intersection of the selected range and the cell on the other side of an area&#039;s edge, then I see that&#039;s what Andy has done. Very elegantly as usual.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I was going to suggest checking the intersection of the selected range and the cell on the other side of an area&#8217;s edge, then I see that&#8217;s what Andy has done. Very elegantly as usual.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Pope</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29170</link>
		<dc:creator>Andy Pope</dc:creator>
		<pubDate>Tue, 04 Dec 2007 15:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29170</guid>
		<description>&lt;p&gt;This does each cell in turn so could be slow for very large selections.&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; BorderAllAroundSelection()&lt;br&gt;
&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rngToBorder &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rngCell &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rngTest &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lngBorderItem &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; vntOffsetRows &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; vntOffsetCols &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; TypeName(Selection) = &lt;span class=&quot;st0&quot;&gt;&quot;Range&quot;&lt;/span&gt; &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; &#160; &lt;br&gt;
&#160; &#160; vntOffsetRows = Array(0, -1, 1, 0)&lt;br&gt;
&#160; &#160; vntOffsetCols = Array(-1, 0, 0, 1)&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; rngToBorder = Selection&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; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; rngCell &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; rngToBorder&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; lngBorderItem = 0 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 3&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; rngTest = rngCell.Offset(vntOffsetRows(lngBorderItem), vntOffsetCols(lngBorderItem))&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Not&lt;/span&gt; rngTest &lt;span class=&quot;kw1&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Intersect(rngTest, rngToBorder) &lt;span class=&quot;kw1&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; rngCell.Borders(lngBorderItem + 7).LineStyle = xlContinuous&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&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 does each cell in turn so could be slow for very large selections.</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> BorderAllAroundSelection()</p>
<p>&nbsp; &nbsp; <span class="kw1">Dim</span> rngToBorder <span class="kw1">As</span> Range<br />
&nbsp; &nbsp; <span class="kw1">Dim</span> rngCell <span class="kw1">As</span> Range<br />
&nbsp; &nbsp; <span class="kw1">Dim</span> rngTest <span class="kw1">As</span> Range<br />
&nbsp; &nbsp; <span class="kw1">Dim</span> lngBorderItem <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> vntOffsetRows <span class="kw1">As</span> <span class="kw1">Variant</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> vntOffsetCols <span class="kw1">As</span> <span class="kw1">Variant</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> TypeName(Selection) = <span class="st0">&#8220;Range&#8221;</span> <span class="kw1">Then</span> <span class="kw1">Exit</span> <span class="kw1">Sub</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; vntOffsetRows = Array(0, -1, 1, 0)<br />
&nbsp; &nbsp; vntOffsetCols = Array(-1, 0, 0, 1)<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">Set</span> rngToBorder = Selection<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; <span class="kw1">For</span> <span class="kw1">Each</span> rngCell <span class="kw1">In</span> rngToBorder<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">For</span> lngBorderItem = 0 <span class="kw1">To</span> 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Set</span> rngTest = rngCell.Offset(vntOffsetRows(lngBorderItem), vntOffsetCols(lngBorderItem))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> <span class="kw1">Not</span> rngTest <span class="kw1">Is</span> <span class="kw1">Nothing</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Intersect(rngTest, rngToBorder) <span class="kw1">Is</span> <span class="kw1">Nothing</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rngCell.Borders(lngBorderItem + 7).LineStyle = xlContinuous<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Next</span><br />
&nbsp; &nbsp; <span class="kw1">Next</span><br />
&nbsp; &nbsp; <br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: d Lee</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29169</link>
		<dc:creator>d Lee</dc:creator>
		<pubDate>Tue, 04 Dec 2007 15:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29169</guid>
		<description>&lt;p&gt;woops i was wrong; u&#039;d need 3. (1) cell  cell above AND cell left -&gt; draw top and left border (2) cell  cell above -&gt; draw top border (3) cell  cell left -&gt; draw left border.&lt;/p&gt;
&lt;p&gt;clearly this works for certain values only; but updates live very nicely. using  would have the effect of boxing values together. should be trivial to make it box values near enough (but &quot;nearness&quot; would not be cumulative; nearness would only be vs immediate neighbours.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>woops i was wrong; u&#8217;d need 3. (1) cell  cell above AND cell left -&gt; draw top and left border (2) cell  cell above -&gt; draw top border (3) cell  cell left -&gt; draw left border.</p>
<p>clearly this works for certain values only; but updates live very nicely. using  would have the effect of boxing values together. should be trivial to make it box values near enough (but &#8220;nearness&#8221; would not be cumulative; nearness would only be vs immediate neighbours.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: d Lee</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/12/04/borders-all-around/#comment-29168</link>
		<dc:creator>d Lee</dc:creator>
		<pubDate>Tue, 04 Dec 2007 15:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1774#comment-29168</guid>
		<description>&lt;p&gt;using conditional formatting u&#039;d probably only need 2 conditions, not 4; i&#039;m thinking 1 condition for a top border and 1 condition for a left border...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>using conditional formatting u&#8217;d probably only need 2 conditions, not 4; i&#8217;m thinking 1 condition for a top border and 1 condition for a left border&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

