title: Hiding locked rows on protected sheet other than active sheet
body: <p>I'm trying to figure out how to hide locked rows using VBA code.
  Let's say I have 3 password protected worksheets, with all cells locked and <strong>UserInterfaceOnly:=True</strong>.</p>
  
  <p>My ActiveX button is on Sheet1. I want to hide Rows("1:2") in all of the Worksheets (Sheet1, Sheet2 and Sheet3). However, the code works fine just for the Sheet the button is on, Sheet1. When it comes to hiding rows on Sheet2/Sheet3, Excel says that I can't hide that range because it is locked. However, it's locked on Sheet1 too, but it simply works and hides/unhides rows 1:2.</p>
  
  <p>I've already made a solution, unprotecting those 2 other sheets right before hiding/unhiding the rows and then protecting them again. This, however, doesn't look OK to me and makes the Excel go between all those sheets which takes some (very little) time and "flashes" when doing so. This is unwanted for me. The code looks like this:</p>
  
  <pre><code>Rows("1:2").EntireRow.Hidden = True
  
  Sheet2.Unprotect Password:=pwd
  Sheet2.Rows("1:2").EntireRow.Hidden = True
  Sheet2.Protect Password:=pwd, AllowFormattingCells:=True, UserInterfaceOnly:=True
  
  Sheet3.Unprotect Password:=pwd
  Sheet3.Rows("1:2").EntireRow.Hidden = True
  Sheet3.Protect Password:=pwd, AllowFormattingCells:=True, UserInterfaceOnly:=True
  </code></pre>
  
  <p>As you can see, I'm not unprotecting Sheet1 and it works.</p>
  
  <p>Is there any way to achieve this or would it always work only on the worksheet which the ActiveX button is on? Also, <strong>I don't want to use AllowFormatingRows:=True</strong>.</p>
  
  <p>Thanks</p>