Hi All,
How do I protect a specific worksheet (not necessarily the "active sheet") with VB. That particular sheet, I initially protected it using "password" the password. Then I'm trying to unprotect the sheet when the userform is initialized. Then when it's terminated, I want to re-protect it. Here is the code I'm trying to use...
To Unprotect
To Protect (haven't really tested this one, just assuming it's wrong because the other doesn't work.
Can someone help me figure out the correct code? Thanks!
How do I protect a specific worksheet (not necessarily the "active sheet") with VB. That particular sheet, I initially protected it using "password" the password. Then I'm trying to unprotect the sheet when the userform is initialized. Then when it's terminated, I want to re-protect it. Here is the code I'm trying to use...
To Unprotect
Code:
Private Sub UserForm_Initialize()
Dim PW As String
PW = "password"
Worksheets("Summary").Unprotect Password: PW
End Sub
Code:
Private Sub UserForm_Terminate()
Dim PW As String
PW = "password"
Worksheets("Summary").protect Password: PW
End Sub