Hi
I have the following VBA which I am using to lock a worksheet at 7am each morning. It appears to be working well but the issue I have is when I come to unlock the document using the password the sheet automatically locks again.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("A1").Value < Date - 1 + (7 / 24) Then
ActiveSheet.Protect Password:="password"
MsgBox "This workbook is locked, please contact ********", vbInformation, "Protected Document"
Else
End If
End Sub
I need the sheet to remain locked until a password is entered. Once the password is entered the sheet is to be edited and then the password protection applied again.
Any help would be much appreciated
Thanks
I have the following VBA which I am using to lock a worksheet at 7am each morning. It appears to be working well but the issue I have is when I come to unlock the document using the password the sheet automatically locks again.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("A1").Value < Date - 1 + (7 / 24) Then
ActiveSheet.Protect Password:="password"
MsgBox "This workbook is locked, please contact ********", vbInformation, "Protected Document"
Else
End If
End Sub
I need the sheet to remain locked until a password is entered. Once the password is entered the sheet is to be edited and then the password protection applied again.
Any help would be much appreciated
Thanks