Requirements before closing the file:
- Protect all sheets
- Hide all sheets except sheet name "Permissions"
- Replace the file without prompt along with password to open the file (Same file name, Same file path)
Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim a110w As Variant Dim path As String a110w = "123" 'P path = Application.ThisWorkbook.path Application.DisplayAlerts = False ThisWorkbook.Unprotect Password:=a110w For Each Worksheet In Sheets Worksheet.Protect Password:=a110w Next For Each Worksheet In Sheets If Not Worksheet.Name = "Permissions" Then Worksheet.Visible = xlVeryHidden Next ThisWorkbook.SaveAs Filename:=path, FileFormat:=50, Password:=a110w Application.DisplayAlerts = True End Sub