title: VBA to change cell protection format from unlocked to locked
body: <p>My worksheet contains cells that are locked to protect formulas and unlocked to allow data entry.  At the end of the worksheet is a sign-off button for a reviewer.  I want to add VBA to this button that will lock the previously unlocked cells (by cell format) to prevent changes after the review is complete for the worksheet.</p>
  
  <p>Here is my current code - </p>
  
  <pre><code>Sub Button9_Click()
  If Range("I108") = Empty Then
  If MsgBox("Are you sure you want to sign-off COMPLETE as Reviewer?", vbYesNo) = vbNo Then Exit Sub
  ActiveWorkbook.ActiveSheet.Unprotect "locked"
  ActiveWorkbook.ActiveSheet.Range("I109").Value = "Reviewed: " &amp; Format(Date, "mm/dd/yyyy") &amp; " By: " &amp; Application.UserName
  ActiveWorkbook.ActiveSheet.Protect "locked"
  End If
  End Sub
  </code></pre>