title: Error 1004 when setting Range.Locked
body: <p>I get the catch-all runtime error 1004, "unable to set the Locked property of the Range class" when, well, trying to set the <a href="http://msdn.microsoft.com/en-us/library/bb213550%28v=office.12%29.aspx" rel="noreferrer"><code>Locked</code></a> property of a Range object. The code looks like this:</p>
  
  <pre><code>that_goddamn_sheet.Unprotect
  
  ; Determine if we should proceed
  
  that_goddamn_range.Locked = True
  
  ; Do more stuff
  
  that_goddamn_sheet.Protect
  </code></pre>
  
  <p>When I set a breakpoint on the line and try to query the value of <code>that_goddamn_range.Locked</code> from the Immediate window, this works without problem, but setting it fails.</p>
  
  <p>If, however, I run <code>that_goddamn_range.Select</code>, break the macro, unprotect the sheet (it gets reprotected automatically on selection change) then right click, pick Properties, switch to the Protection tab and tick Locked then confirm, things work okay however.</p>
  
  <p>What could possibly be going wrong?</p>