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.
Here is my current 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: " & Format(Date, "mm/dd/yyyy") & " By: " & Application.UserName
ActiveWorkbook.ActiveSheet.Protect "locked"
End If
End Sub
ActiveWorkbook.ActiveSheet.Cells.Locked = True
in your code. 2) is "locked" the password of the worksheet? – EEM