View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default 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