Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheets(1)
.Unprotect Password:="Test"
.Cells.Locked = True
.Protect Password:="Test", DrawingObjects:=True, Contents:=True, Scenarios:=True ', AllowFormattingCells:=True
.EnableSelection = xlNoSelection 'xlUnlockedCells
End With
ThisWorkbook.Save
End Sub