Eric Carolus
Board Regular
- Joined
- Sep 17, 2012
- Messages
- 128
- Office Version
- 2016
- Platform
- Windows
Good Day folks on this Merry Christmas Day
For the last couple of days now I had tried in vain to protect some
sheets from deletion (in the same workbook) while others, after being copied from a
template should be prevented from deletion/protected from deletion.
The workbook contains 4 sheets that the user should not be able to delete. The sheet called "Master" is a template and must always be available.
The user should not be able to delete it. The sheet called Add _Person contains a dynamic list called 'ListNames'. These names are used to to name the sheets
after an employee (and is functional). My main problem is protecting some sheets from deletion while others should not be deleted
by the user.
I have tried numerous strategies
Private Sub Workbook_Open()
Me.Worksheets("Sheet1").Protect Password:="myPassword", UserInterfaceOnly:=True Private Sub Worksheet_Activate()
ThisWorkbook.Protect Password:="password", Structure:=True
End Sub
OR
Private Sub Worksheet_Deactivate()
ThisWorkbook.Unprotect Password:="password"
End Sub
Me.Worksheets("Sheet2").Protect Password:="myPassword", UserInterfaceOnly:=True
Me.Worksheets("Sheet3").Protect Password:="myPassword", UserInterfaceOnly:=True
End Sub
Your help will surely be appreciated.
Thank you
Ps. I include a copy of the workbook to further elucidate my problem.
For the last couple of days now I had tried in vain to protect some
sheets from deletion (in the same workbook) while others, after being copied from a
template should be prevented from deletion/protected from deletion.
The workbook contains 4 sheets that the user should not be able to delete. The sheet called "Master" is a template and must always be available.
The user should not be able to delete it. The sheet called Add _Person contains a dynamic list called 'ListNames'. These names are used to to name the sheets
after an employee (and is functional). My main problem is protecting some sheets from deletion while others should not be deleted
by the user.
I have tried numerous strategies
Private Sub Workbook_Open()
Me.Worksheets("Sheet1").Protect Password:="myPassword", UserInterfaceOnly:=True Private Sub Worksheet_Activate()
ThisWorkbook.Protect Password:="password", Structure:=True
End Sub
OR
Private Sub Worksheet_Deactivate()
ThisWorkbook.Unprotect Password:="password"
End Sub
Me.Worksheets("Sheet2").Protect Password:="myPassword", UserInterfaceOnly:=True
Me.Worksheets("Sheet3").Protect Password:="myPassword", UserInterfaceOnly:=True
End Sub
Your help will surely be appreciated.
Thank you
Ps. I include a copy of the workbook to further elucidate my problem.