<?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>Bacon Bits: &#187; Worksheet Protection</title>
	<atom:link href="http://datapigtechnologies.com/blog/index.php/category/worksheet-protection/feed/" rel="self" type="application/rss+xml" />
	<link>http://datapigtechnologies.com/blog</link>
	<description>A DataPig Technologies Blog</description>
	<lastBuildDate>Sun, 01 Jan 2012 21:30:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Automatically Unprotect Sheets Based on Domain Name</title>
		<link>http://datapigtechnologies.com/blog/index.php/automatically-unprotect-sheets-based-on-domain-name/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/automatically-unprotect-sheets-based-on-domain-name/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 09:16:26 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[Worksheet Protection]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/index.php/automatically-unprotect-sheets-based-on-domain-name/</guid>
		<description><![CDATA[POLO (one of my 12 fans) asks a question: "I want to control read and write access to an Excel file using either windows logins or a list in Excel. Like match userid to the list in Excel and then give either write or read only access to the spreadsheet. Is it possible?" The answer [...]
Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/capture-a-users-domainusername/' rel='bookmark' title='Capture a User’s Domain\UserName'>Capture a User’s Domain\UserName</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/worksheet-protection-best-practice/' rel='bookmark' title='Worksheet Protection Best Practice'>Worksheet Protection Best Practice</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/running-crosstab-queries-in-excel/' rel='bookmark' title='Running Crosstab Queries in Excel'>Running Crosstab Queries in Excel</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/auto-adjust-chart-label-positions/' rel='bookmark' title='Auto Adjust Chart Label Positions'>Auto Adjust Chart Label Positions</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/sort-by-color-in-excel-2003/' rel='bookmark' title='Sort by Color in Excel 2003'>Sort by Color in Excel 2003</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>POLO (one of my 12 fans) asks a question:</p>
<p><em>"I want to control read and write access to an Excel file using either windows logins or a list in Excel. Like match userid to the list in Excel and then give either write or read only access to the spreadsheet. Is it possible?"<br />
</em></p>
<p>The answer is yes. You can capture a user's Windows Domain\UserName (<a href="http://datapigtechnologies.com/blog/index.php/capture-a-users-domainusername/" target="_blank">see my previous post on this</a>) and throw that against a list in Excel to determine permissions and views.<br />
<span id="more-3159"></span><br />
<span style="color: white;">.<br />
</span><br />
<span style="color: white;">.<br />
</span></p>
<p>In this scenario, your sheets would be protected by default, rendering them read only. Meaning, you would apply worksheet protection so that your sheets are protected when the file opens. The idea is to have Excel automatically unlock the sheet protection only for those who are in a list of authorized Read/Write users.</p>
<p><span style="color: white;">.<br />
</span><br />
<span style="color: white;">.<br />
</span></p>
<p><strong>Step 1: </strong>Create a list of Domain\Usernames for those individuals who are Read/Write users. The values in this list will have to be written exactly the way the domain names show up in your organization.  Once completed, create a Named Range for this list. In this example, I've called my list "<strong>DomainList</strong>".</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2011/04/041311_0916_Automatical1.png" alt="" /><span style="font-size: 12pt;"><strong><br />
</strong></span></p>
<p><span style="color: white;">.<br />
</span></p>
<p><strong>Step 2: </strong>Copy and paste this code into a standard module. This will allow you to get the users Domain\Username.</p>
<p style="background: white;"><span style="font-family: Arial; font-size: 10pt;"><span style="color: #2e2e2e;"><strong><em></p>
<div class="igBar"><span id="lvb-2"><a href="#" onclick="javascript:showPlainTxt('vb-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-2">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Function</span> getReturnUName<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">getReturnUName = <span style="color: #b1b100;">Environ</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"UserDomain"</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp; <span style="color: #ff0000;">"\"</span> &amp; <span style="color: #b1b100;">Environ</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"Username"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Function</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</em></strong></span><span style="color: #4d4d4d;"><br />
</span></span></p>
<p><span style="color: white;">.<br />
</span></p>
<p><strong>Step 3: </strong>In the Workbook's Open event, enter some code that will compare the user's domain information (via the <span style="color: #2e2e2e; font-family: Arial; font-size: 10pt;"><em>getReturnUName</em></span> function you just created) to your DomainList. If there is a match, then you can unprotect the appropriate sheets – making them read/write.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2011/04/041311_0916_Automatical2.png" alt="" /></p>
<p><span style="color: white;">.<br />
</span></p>
<p><strong>Step 4: </strong>Of course, you'll want to ensure the workbook re-protects the sheets before closing. So in the Workbook's BeforeClose event, enter some code to protect the appropriate sheets.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2011/04/041311_0916_Automatical3.png" alt="" /></p>
<p><span style="color: white;">.<br />
</span></p>
<p>Well that's pretty much it.  You now have a smart workbook that automatically detects the user and unprotects if the user in in special read/write list.</p>
<p><span style="color: white;">.<br />
</span></p>
<p>Notes:</p>
<p>1. You'll want to protect the VBA Modules, hiding the code. (From within the VBE go to Tools&gt;VBAProject Properties and then click the Protection page tab and then check "Lock project from viewing" and then enter your password and again to confirm it.)</p>
<p>2. You'll probably want to hide the sheet that contains your DomainList.</p>
<p>3. I don't have to tell you that this technique is far from a hacker proof system of managing permissions. At best, it's a way to allow your 'Admin' users to work with the workbook without constantly having to enter passwords.</p>
<p><span style="color: white;">.<br />
</span></p>
<p>Next week, I'll show you how to use a similar technique to automatically hide and unhide certain sheets based on each individual user.</p>
<p>Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/capture-a-users-domainusername/' rel='bookmark' title='Capture a User’s Domain\UserName'>Capture a User’s Domain\UserName</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/worksheet-protection-best-practice/' rel='bookmark' title='Worksheet Protection Best Practice'>Worksheet Protection Best Practice</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/running-crosstab-queries-in-excel/' rel='bookmark' title='Running Crosstab Queries in Excel'>Running Crosstab Queries in Excel</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/auto-adjust-chart-label-positions/' rel='bookmark' title='Auto Adjust Chart Label Positions'>Auto Adjust Chart Label Positions</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/sort-by-color-in-excel-2003/' rel='bookmark' title='Sort by Color in Excel 2003'>Sort by Color in Excel 2003</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/automatically-unprotect-sheets-based-on-domain-name/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Worksheet Protection Best Practice</title>
		<link>http://datapigtechnologies.com/blog/index.php/worksheet-protection-best-practice/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/worksheet-protection-best-practice/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 10:22:47 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel Tips and Tricks]]></category>
		<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[Worksheet Protection]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=2435</guid>
		<description><![CDATA[I was reviewing someone's workbook the other day way I saw some code similar to this: Sheets("Sheet1").Unprotect Password:="MeatFace" PROCEDURE Sheets("Sheet1).Protect Password:=" MeatFace " This code unprotects the sheet, runs a procedure, and then protects the sheet again.  The reason this guy wrapped his procedure with Unprotect/Protect is because his procedure changes a worksheet in some way. [...]
Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/' rel='bookmark' title='Limiting Movement within Your Worksheet'>Limiting Movement within Your Worksheet</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/protect-worksheet-structure-with-array-formulas/' rel='bookmark' title='Protect Worksheet Structure with Array Formulas'>Protect Worksheet Structure with Array Formulas</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/mimicking-scroll-lock/' rel='bookmark' title='Mimicking Scroll Lock'>Mimicking Scroll Lock</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/sort-by-color-in-excel-2003/' rel='bookmark' title='Sort by Color in Excel 2003'>Sort by Color in Excel 2003</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/zoom-into-spreadsheet-on-double-click/' rel='bookmark' title='Zoom into Spreadsheet on Double-Click'>Zoom into Spreadsheet on Double-Click</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I was reviewing someone's workbook the other day way I saw some code similar to this:</p>
<p><em>Sheets("Sheet1").Unprotect Password:="MeatFace"<br />
PROCEDURE<br />
Sheets("Sheet1).Protect Password:=" MeatFace "<br />
</em></p>
<p>This code unprotects the sheet, runs a procedure, and then protects the sheet again.  The reason this guy wrapped his procedure with Unprotect/Protect is because his procedure changes a worksheet in some way. And you cannot run a macro that changes a worksheet while that worksheet is protected.</p>
<p> <span id="more-2435"></span></p>
<p>Now, I'll bet a bunch of you still wrap your procedures with Unprotect/Protect. So I'm here to tell you that although this technique does work, it does have a couple of drawbacks.  First, if the code in the middle errors out, then your sheet won't become protected again. Second, every procedure (that changes the worksheet) would need to be wrapped in your UnProtect/Protect statements. This obviously leads to redundant code which could be difficult to manage.</p>
<p> </p>
<p>A better way is to protect your worksheet with the optional <strong>UserIntefaceOnly </strong>argument.</p>
<p>Place this code in the Workbook Open event:</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/08/082610_1022_WorksheetPr1.png" alt="" /></p>
<p> </p>
<p>When you set the UserInterfaceOnly argument to True, you tell Excel that the worksheet protection does not apply to macros. This will allow your macros to run without having to constantly protect and unprotect your worksheet. </p>
<p> </p>
<p> </p>
<p><span style="font-size:12pt"><strong>Bonus Tip - Free of Charge</strong></span></p>
<p>There are other arguments (similar to UserInterfaceOnly) that can help better define what happens when you protect your worksheet.</p>
<p>For example, if I wanted to protect my worksheet, but still allow my customers to Enable/Disable Autofilters, I would add the AllowFiltering argument:</p>
<p><strong><em>Sub ProtectSheet()<br />
Sheets("Sheet1").Protect _<br />
Password:="MyPassword", _<br />
AllowFiltering:=True<br />
End Sub<br />
</em></strong></p>
<p> </p>
<p>Here is a list of the arguments you can leverage – painstakingly copied and pasted from Excel help.</p>
<div>
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 171px;" span="1"></col>
<col style="width: 387px;" span="1"></col>
</colgroup>
<tbody>
<tr style="background: #dce6f1; height: 21px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>DrawingObjects</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> to protect shapes. The default value is <strong>True</strong>.</span></td>
</tr>
<tr style="background: #f7f7ff; height: 61px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>Contents</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> to protect contents. For a chart, this protects the entire chart. For a worksheet, this protects the locked cells. The default value is <strong>True</strong>.</span></td>
</tr>
<tr style="background: #dce6f1; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>Scenarios</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> to protect scenarios. This argument is valid only for worksheets. The default value is <strong>True</strong>.</span></td>
</tr>
<tr style="background: #f7f7ff; height: 61px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>UserInterfaceOnly</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> to protect the user interface, but not macros. If this argument is omitted, protection applies both to macros and to the user interface.</span></td>
</tr>
<tr style="background: #dce6f1; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowFormattingCells</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to format any cell on a protected worksheet. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #f7f7ff; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowFormattingColumns</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to format any column on a protected worksheet. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #dce6f1; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowFormattingRows</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to format any row on a protected. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #f7f7ff; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowInsertingColumns</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to insert columns on the protected worksheet. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #dce6f1; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowInsertingRows</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to insert rows on the protected worksheet. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #f7f7ff; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowInsertingHyperlinks</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to insert hyperlinks on the worksheet. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #dce6f1; height: 61px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowDeletingColumns</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to delete columns on the protected worksheet, where every cell in the column to be deleted is unlocked. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #f7f7ff; height: 61px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowDeletingRows</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to delete rows on the protected worksheet, where every cell in the row to be deleted is unlocked. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #dce6f1; height: 61px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowSorting</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to sort on the protected worksheet. Every cell in the sort range must be unlocked or unprotected. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #f7f7ff; height: 81px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowFiltering</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to set filters on the protected worksheet. Users can change filter criteria but can not enable or disable an auto filter. Users can set filters on an existing auto filter. The default value is <strong>False</strong>.</span></td>
</tr>
<tr style="background: #dce6f1; height: 41px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><em>AllowUsingPivotTables</em></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid #d5d5d3 1.0pt; border-right:  none" valign="middle"><span style="color:black"><strong>True</strong> allows the user to use pivot table reports on the protected worksheet. The default value is <strong>False</strong>.</span></td>
</tr>
</tbody>
</table>
</div>
<p>Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/' rel='bookmark' title='Limiting Movement within Your Worksheet'>Limiting Movement within Your Worksheet</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/protect-worksheet-structure-with-array-formulas/' rel='bookmark' title='Protect Worksheet Structure with Array Formulas'>Protect Worksheet Structure with Array Formulas</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/mimicking-scroll-lock/' rel='bookmark' title='Mimicking Scroll Lock'>Mimicking Scroll Lock</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/sort-by-color-in-excel-2003/' rel='bookmark' title='Sort by Color in Excel 2003'>Sort by Color in Excel 2003</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/zoom-into-spreadsheet-on-double-click/' rel='bookmark' title='Zoom into Spreadsheet on Double-Click'>Zoom into Spreadsheet on Double-Click</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/worksheet-protection-best-practice/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Hack into a protected Excel 2007 Sheet</title>
		<link>http://datapigtechnologies.com/blog/index.php/hack-into-a-protected-excel-2007-sheet/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/hack-into-a-protected-excel-2007-sheet/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 06:40:27 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Worksheet Protection]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Power Tips]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=959</guid>
		<description><![CDATA[When Microsoft introduced Excel 2007, they introduced new file types - we all know them by now: xlsx, xlsm, xltx, etc. These file types are often referred to as Open XML. That's because the new file types are essentially packages that contain XML files. If you take an xlsx file and change the extension to [...]
Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/protect-worksheet-structure-with-array-formulas/' rel='bookmark' title='Protect Worksheet Structure with Array Formulas'>Protect Worksheet Structure with Array Formulas</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/' rel='bookmark' title='Limiting Movement within Your Worksheet'>Limiting Movement within Your Worksheet</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>When Microsoft introduced Excel 2007, they introduced new file types - we all know them by now: xlsx, xlsm, xltx, etc. These file types are often referred to as Open XML. That's because the new file types are essentially packages that contain XML files. If you take an xlsx file and change the extension to zip, you'll be able to see all the xml documents that make up your Excel file.</p>
<p> </p>
<p>The new Open XML file types come with lots of benefits. One of the major benefits is that you can change the content and properties of an Excel 2007 file simply by manipulating the XML documents that make it up.</p>
<p> </p>
<p>Well, while playing with the Open XML files, I discovered that you can remove spreadsheet protection simply by applying a simple edit to the xml within the Excel file.</p>
<p> <span id="more-959"></span></p>
<p>Say I have a workbook where Sheet1 is password protected. So I think to myself, "the nerve of some people - trying to keep me out of their spreadsheet".</p>
<p>I decide that I want to unprotect this sheet, but I don't know the password. Because this is Excel 2007, I'll hack into the xml and remove the spreadsheet protection.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/091809_0637_Hackintoapr1.png" alt="" /></p>
<p> </p>
<p> </p>
<p><strong>Step 1: </strong>Make a backup of your file in case you really monkey it up.</p>
<p><strong>Step 2: </strong>Change the file extension to zip.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/091809_0637_Hackintoapr2.png" alt="" /></p>
<p> </p>
<p><strong>Step 3: </strong>Extract the contents of the zip file.</p>
<p><strong>Step 4: </strong>Go to the extracted files and navigate to the xml for the target sheet (found in the 'xl\worksheets' directory)</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/091809_0637_Hackintoapr3.png" alt="" /></p>
<p> </p>
<p><strong>Step 5: </strong>Open the target sheet's xml document using an XML editor (I use a free editor called <a href="http://symbolclick.com/index.htm" target="_blank">XML Marker</a>)</p>
<p> </p>
<p><strong>Step 6: </strong>Find the 'sheetProtection' tag and remove the entire line.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/091809_0637_Hackintoapr4.png" alt="" /></p>
<p> </p>
<p><strong>Step 7: </strong>Save the edited xml document and replace the old xml document found in the original zip file.</p>
<p> </p>
<p><strong>Step 8:</strong> Change the extension back to xlsx.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/091809_0637_Hackintoapr5.png" alt="" /></p>
<p> </p>
<p><strong>Step 9: </strong>Enjoy your unprotected sheet.</p>
<p> </p>
<p>That's right folks; simply removing the sheetProtection element from the xml part negates all protections placed on that sheet. Amazing, right?</p>
<p> </p>
<p>A couple of notes:</p>
<ol>
<li>Any password you see in the XML file is not the real password, nor will it work if you try to use it. It's worthless.</li>
<li>Unfortunately, it doesn't seem as though you can unprotect an entire workbook this way. Something prevents you from even opening the Open XML package for a protected Workbook.</li>
<li>Do I have to even mention that this doesn't apply to any xls files?</li>
<li>Of course, you could do this all programmatically, but this strikes me as a one-off kind of thing. So coding something up is just not worth it to me.</li>
</ol>
<p>Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/protect-worksheet-structure-with-array-formulas/' rel='bookmark' title='Protect Worksheet Structure with Array Formulas'>Protect Worksheet Structure with Array Formulas</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/' rel='bookmark' title='Limiting Movement within Your Worksheet'>Limiting Movement within Your Worksheet</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/hack-into-a-protected-excel-2007-sheet/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Protect Worksheet Structure with Array Formulas</title>
		<link>http://datapigtechnologies.com/blog/index.php/protect-worksheet-structure-with-array-formulas/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/protect-worksheet-structure-with-array-formulas/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 14:36:25 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel Formulas]]></category>
		<category><![CDATA[Excel Tips and Tricks]]></category>
		<category><![CDATA[Worksheet Protection]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Formulas]]></category>
		<category><![CDATA[Power Tips]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=610</guid>
		<description><![CDATA[In the another display of passive aggressive behavior, I want to show you a trick you can use to prevent anyone from adding or deleting rows or columns by using a simple array formula.  I'm pretty sure I got this trick from Bob Umlas.  Most Bob tricks, they are extremely cool, but I never seem to find situations where I can use them.  [...]
Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/' rel='bookmark' title='Limiting Movement within Your Worksheet'>Limiting Movement within Your Worksheet</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/creating-subtotals-on-many-columns/' rel='bookmark' title='Creating Subtotals on Many Columns'>Creating Subtotals on Many Columns</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/outta-my-way-formula-thingy/' rel='bookmark' title='Outta My Way Formula Thingy!'>Outta My Way Formula Thingy!</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/choosing-quarters-in-excel/' rel='bookmark' title='Choosing Quarters in Excel'>Choosing Quarters in Excel</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/zoom-into-spreadsheet-on-double-click/' rel='bookmark' title='Zoom into Spreadsheet on Double-Click'>Zoom into Spreadsheet on Double-Click</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In the another display of passive aggressive behavior, I want to show you a trick you can use to prevent anyone from adding or deleting rows or columns by using a simple array formula. </p>
<p>I'm pretty sure I got this trick from Bob Umlas.  Most Bob tricks, they are extremely cool, but I never seem to find situations where I can use them.  But, maybe this trick will hit the spot for some of you.</p>
<p><span style="color: #ffffff;">.<span id="more-610"></span><br />
.</span></p>
<p><strong>Step 1:</strong>  Highlight the rows where you don't rows added or deleted. </p>
<p>Type <strong><span style="color: #800000;">=""</span></strong></p>
<p><span style="color: #000000;">Press Shift+Ctrl+Enter to apply the array.</span></p>
<p><img class="alignnone size-full wp-image-612" title="protectwitharray1" src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/07/protectwitharray1.png" alt="protectwitharray1" width="424" height="333" /></p>
<p><span style="color: #ffffff;">.<br />
.</span></p>
<p><strong>Step 2:</strong>  Highlight the columns where you don't rows added or deleted. </p>
<p>Type <strong><span style="color: #800000;">=""</span></strong></p>
<p><span style="color: #000000;">Press Shift+Ctrl+Enter to apply the array.</span></p>
<p><img class="alignnone size-full wp-image-613" title="protectwitharray2" src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/07/protectwitharray2.png" alt="protectwitharray2" width="416" height="332" /></p>
<p><span style="color: #ffffff;">.<br />
.</span></p>
<p><strong>Step 3:</strong> Hide the array formulas along with anything else you don't want your users to see.</p>
<p>When your users try to add or delete a column or row in the protected area, they'll get a face full of error message.</p>
<p><img class="alignnone size-full wp-image-611" title="protectwitharray3" src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/07/protectwitharray3.png" alt="protectwitharray3" width="369" height="317" /></p>
<p><span style="color: #ffffff;">.<br />
.</span></p>
<p>I think this would be useful if you didn't want apply sheet protection but still wanted to prevent structural changes.  Although - I can't think of any reason why you would stay away from sheet protection.</p>
<p>What do you think?</p>
<p>Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/' rel='bookmark' title='Limiting Movement within Your Worksheet'>Limiting Movement within Your Worksheet</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/creating-subtotals-on-many-columns/' rel='bookmark' title='Creating Subtotals on Many Columns'>Creating Subtotals on Many Columns</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/outta-my-way-formula-thingy/' rel='bookmark' title='Outta My Way Formula Thingy!'>Outta My Way Formula Thingy!</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/choosing-quarters-in-excel/' rel='bookmark' title='Choosing Quarters in Excel'>Choosing Quarters in Excel</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/zoom-into-spreadsheet-on-double-click/' rel='bookmark' title='Zoom into Spreadsheet on Double-Click'>Zoom into Spreadsheet on Double-Click</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/protect-worksheet-structure-with-array-formulas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limiting Movement within Your Worksheet</title>
		<link>http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 03:42:01 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel Tips and Tricks]]></category>
		<category><![CDATA[Worksheet Protection]]></category>
		<category><![CDATA[Excel]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=454</guid>
		<description><![CDATA[It's always fun to be passive aggressive toward your users. Here's a new way to exert your impotent rage on the power user who's always doing wonky things to your spreadsheets. You can limit navigation to a certain range of cells. Here's how:   Step 1: Press Alt+F11 to get to the Visual Basic Editor Step 2: [...]
Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/outta-my-way-formula-thingy/' rel='bookmark' title='Outta My Way Formula Thingy!'>Outta My Way Formula Thingy!</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/using-arrows-to-edit-a-named-range/' rel='bookmark' title='Using Arrows to Edit a Named Range'>Using Arrows to Edit a Named Range</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/zoom-into-spreadsheet-on-double-click/' rel='bookmark' title='Zoom into Spreadsheet on Double-Click'>Zoom into Spreadsheet on Double-Click</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/find-and-highlight-specific-values/' rel='bookmark' title='Find and Highlight Specific Values'>Find and Highlight Specific Values</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/creating-subtotals-on-many-columns/' rel='bookmark' title='Creating Subtotals on Many Columns'>Creating Subtotals on Many Columns</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It's always fun to be passive aggressive toward your users.</p>
<p>Here's a new way to exert your impotent rage on the power user who's always doing wonky things to your spreadsheets.</p>
<p>You can limit navigation to a certain range of cells. Here's how:</p>
<p> <span id="more-454"></span></p>
<p><strong>Step 1:</strong> Press Alt+F11 to get to the Visual Basic Editor</p>
<p><strong>Step 2:</strong> Choose the sheet you're working with.</p>
<p> </p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/07/071209_0641_LimitingMov1.png" alt="" /></p>
<p> </p>
<p><strong>Step 3:</strong> Activate the Properties for that sheet by clicking View -&gt; Properties Window</p>
<p><strong>Step 4:</strong> In the 'ScrollArea' property, enter the range in which you would like to limit scrolling.</p>
<p> </p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/07/071209_0641_LimitingMov2.png" alt="" /></p>
<p> </p>
<p>Once you've implemented a limit, your users will not be able to navigate outside the set boundaries.</p>
<p> </p>
<p>You can also apply this via VBA.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/07/071209_0641_LimitingMov3.png" alt="" /></p>
<p> </p>
<p>To really make them feel like a monkey, you can hide the off limit columns.</p>
<p>This way, they get a safe little 'play area' where mummy and daddy can watch them closely.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/07/071209_0641_LimitingMov4.png" alt="" /></p>
<p>Related posts:<ol>
<li><a href='http://datapigtechnologies.com/blog/index.php/outta-my-way-formula-thingy/' rel='bookmark' title='Outta My Way Formula Thingy!'>Outta My Way Formula Thingy!</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/using-arrows-to-edit-a-named-range/' rel='bookmark' title='Using Arrows to Edit a Named Range'>Using Arrows to Edit a Named Range</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/zoom-into-spreadsheet-on-double-click/' rel='bookmark' title='Zoom into Spreadsheet on Double-Click'>Zoom into Spreadsheet on Double-Click</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/find-and-highlight-specific-values/' rel='bookmark' title='Find and Highlight Specific Values'>Find and Highlight Specific Values</a></li>
<li><a href='http://datapigtechnologies.com/blog/index.php/creating-subtotals-on-many-columns/' rel='bookmark' title='Creating Subtotals on Many Columns'>Creating Subtotals on Many Columns</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/limiting-movement-within-your-worksheet/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

