Got it! ... Two possible fixes:
1) Option 1 Fix: Comment out "Set Wks = ActiveSheet" (see 1st code below). This line is not necessary, and causes problems as explained below.
2) Option 2 Fix: Change the ByRef to ByVal in the called procedure "UnLockCells" (see 2nd code below).
3) Or do BOTH ...
Explanation as to why the above messes up the desired action:
1) When "UnLockCells" procedure is called by the "validatePW()" procedure, it sends WS (the worksheet that it wants to UNLOCK the desired cells). But, since this worksheet was read ByRef, this UnLockCells procedure was CHANGING the definition of this WS worksheet to the ActiveSheet, the sheet you are currently sitting on (see the "Set Wks = ActiveSheet" line in this UnLockCells" procedure, OPTION #1 FIX shown below).
2) Then, when control went back to "validatePW()", WS wasn't the next sheet in the line-up, but instead the ActiveSheet. So, in the next step of "validatePW()", when it tried to Protect the sheet that it just UNLOCKED, well, since WS got changed to the ActiveSheet, it never Protected the next sheets in the line-up, but only the ActiveSheet.
Take care and best regards!
Bookmarks