![]() |
Protecting Sheets, automatically protects the workbook
I am trying to protect particular sheets in a workbook.
Code used: Private Sub Workbook_Open() Password = "1234" Sheets("MasterData").Protect Password, True, True, True Sheets("Unassigned Requests").Protect Password, True, True, True End sub And i unprotect using Sheets("Unassigned Requests").Unprotect Password This protects my entire workbook when i open it the next time. How to avoid this? |
Protecting Sheets, automatically protects the workbook
First, you have another active thread.
Second, the code you included here doesn't protect the workbook--it protects those worksheets. Excel has various levels of protection. Worksheet protection (tools|protection|protect sheet) -- to keep users from changing locked cells and changing formatting. workbook protection (tools|protection|protect workbook) -- to keep users from inserting/deleting worksheets (structure) or to keep the users from changing the window sizes (Windows) VBA Project protection -- to keep your code from prying eyes. And workbook protection (again). This can be used to prevent users from even opening the workbook--or only allow the user to open in readonly mode. Your code does that worksheet protection stuff. Thiaga wrote: I am trying to protect particular sheets in a workbook. Code used: Private Sub Workbook_Open() Password = "1234" Sheets("MasterData").Protect Password, True, True, True Sheets("Unassigned Requests").Protect Password, True, True, True End sub And i unprotect using Sheets("Unassigned Requests").Unprotect Password This protects my entire workbook when i open it the next time. How to avoid this? -- Dave Peterson |
Protecting Sheets, automatically protects the workbook
Private Sub Workbook_Open()
Sheets("masterdata").protect Password = "1234" Sheets("Unassigned Requests").Protect Password="1234" End sub And i unprotect Sheets("Unassigned Requests").Unprotect Password ="1234" "Thiaga" wrote: I am trying to protect particular sheets in a workbook. Code used: Private Sub Workbook_Open() Password = "1234" Sheets("MasterData").Protect Password, True, True, True Sheets("Unassigned Requests").Protect Password, True, True, True End sub And i unprotect using Sheets("Unassigned Requests").Unprotect Password This protects my entire workbook when i open it the next time. How to avoid this? |
All times are GMT +1. The time now is 01:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com