vbacoder12
New Member
- Joined
- Sep 4, 2024
- Messages
- 20
- Office Version
- Prefer Not To Say
- Platform
- Windows
Hi.
I wrote the vba below to keep a workbook open until a certain date then lock it. When I try to unprotect I get "this password you supplied is not correct. Verify that the caps locks is off and be sure to use the correct capitalization.
Private Sub worksheet()
Activesheet.unprotect password ="dog98"
If Date > dateserial (2024,9,15) then
Range ("H:N").locked=TRUE
Range("A:G").locked=TRUE
Activesheet.Protect Password="dog98"
ThisWorkbook.Save
End If
End Sub
I wrote the vba below to keep a workbook open until a certain date then lock it. When I try to unprotect I get "this password you supplied is not correct. Verify that the caps locks is off and be sure to use the correct capitalization.
Private Sub worksheet()
Activesheet.unprotect password ="dog98"
If Date > dateserial (2024,9,15) then
Range ("H:N").locked=TRUE
Range("A:G").locked=TRUE
Activesheet.Protect Password="dog98"
ThisWorkbook.Save
End If
End Sub