<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Virtage Developer &#187; Excel</title>
	<atom:link href="http://devel.virtage.com/tag/excel/feed/" rel="self" type="application/rss+xml" />
	<link>http://devel.virtage.com</link>
	<description>Blogging and tutorials on Ajax, Web 2.0, (X)HTML, CSS, JavaScript, Python and PHP</description>
	<lastBuildDate>Sun, 08 Aug 2010 13:42:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>en: Highlight current row in Excel using VBA</title>
		<link>http://devel.virtage.com/2009/01/en-highlight-current-row-in-excel-using-vba/</link>
		<comments>http://devel.virtage.com/2009/01/en-highlight-current-row-in-excel-using-vba/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 07:29:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Excel]]></category>

		<guid isPermaLink="false">http://devel.virtage.com/?p=31</guid>
		<description><![CDATA[Highlighing currently edited row for better user experience that maybe someday buil-in in Excel, meanwhile you must use Visual Basic for Application code to do this. It&#8217;s very helpful especially in very wide long rows. In this tutorial I will show you how to employ Excel event model to highligh current row.

Download the example workbook [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Highlighing currently edited row for better user experience that maybe someday buil-in in Excel, meanwhile you must use Visual Basic for Application code to do this. It&#8217;s very helpful especially in very wide long rows. In this tutorial I will show you how to employ Excel event model to highligh current row.</strong><br />
<span id="more-31"></span></p>
<p><em>Download the <a href="http://devel.virtage.com/wp-content/uploads/2009/01/book3.xls">example workbook with highlighing current row</a>.</em></p>
<ol>
<li>Firstly,<strong> format some cell like a highlighted one should looks like</strong> using different background color, font weight, font color, anything you want. Here, cell A4 is formated like highlighted.<br />
<img class="alignnone size-full wp-image-64" title="excelhighlightrow1" src="http://devel.virtage.com/wp-content/uploads/2009/01/excelhighlightrow1.png" alt="excelhighlightrow1" width="703" height="453" /></li>
<li><strong>Define a new style named „Highlight“. </strong> This style will be used for an entire row.
<ul>
<li>Select menu item <em>Format / Style</em>.<br />
<img class="alignnone size-full wp-image-65" title="excelhighlightrow2" src="http://devel.virtage.com/wp-content/uploads/2009/01/excelhighlightrow2.png" alt="excelhighlightrow2" width="374" height="234" /></li>
<li>In <em>Style</em> dialog fill in name „Highligh“, uncheck <em>Number, Alignment </em>and <em>Protection</em> checkboxes.<br />
<img class="alignnone size-full wp-image-66" title="excelhighlightrow3" src="http://devel.virtage.com/wp-content/uploads/2009/01/excelhighlightrow3.png" alt="excelhighlightrow3" width="388" height="256" /></li>
<li>Click <em>Add</em> button.</li>
<li>Now we have two styles: Highlight for current row, and Normal for the rest of worksheet.</li>
</ul>
</li>
<li><strong>Open VBA editor</strong> by pressing <em>Alt+F11</em> or <em>Tools / Marco / Visual Basic Editor</em>.</li>
<li>Create new Worksheet_SelectionChange event handler.
<ul>
<li>Double-click in left pane to sheet and file where you want to highlight row (e.g. sheet <em>Sheet1 </em>in file <em>Book3.xls</em>)<br />
<img class="alignnone size-full wp-image-67" title="excelhighlightrow4" src="http://devel.virtage.com/wp-content/uploads/2009/01/excelhighlightrow4.png" alt="excelhighlightrow4" width="199" height="304" /></li>
<li>Then in code editor select <em>Worksheet</em> from Object drop-down box and <em>SelectionChange </em>from Procedure drop-down box.<br />
<img class="alignnone size-full wp-image-68" title="excelhighlightrow5" src="http://devel.virtage.com/wp-content/uploads/2009/01/excelhighlightrow5.png" alt="excelhighlightrow5" width="699" height="322" /></li>
<li>VBA will create blank <em>Worksheet_SelectionChange</em> procedure acting like SelectionChange event handler.</li>
</ul>
</li>
<li><strong>Paste the code. </strong>SelectionChange event will fire everytime you change cell (by arrow key, mouse, click to row/column header). In this case, we want to highlight a row. Paste following source code to the body of handler.</li>
</ol>
<pre>' Highlight only if selection change was made inside the content range (A2:E50)
If Not Intersect(Target, Range("A2:E50")) Is Nothing Then
  ' Turn off screen updating for better performace
  Application.ScreenUpdating = False

  ' Clear style of content range (A2:E50)
  Range("A2:E50").Style = "Normal"

  ' Set highligh style to current row
  ' (will Target.Row contains current row number)
  Range("A" &amp; Target.Row &amp; ":E" &amp; Target.Row).Style = "Highlight"

  ' Turn on screen updating
  Application.ScreenUpdating = True
End If</pre>
]]></content:encoded>
			<wfw:commentRss>http://devel.virtage.com/2009/01/en-highlight-current-row-in-excel-using-vba/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
