Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting workbook sheets Learner101b Excel Discussion (Misc queries) 3 February 3rd 08 08:25 PM
Protecting sheets within a workbook Ridge Excel Discussion (Misc queries) 1 October 3rd 07 02:44 PM
Code to protect sheets, protects work book also? thiaga Excel Programming 7 March 2nd 06 11:00 PM
Protecting a book protects too much?! StargateFanFromWork Excel Programming 2 July 6th 04 12:52 PM
Protecting all sheets in a workbook abxy[_48_] Excel Programming 2 April 10th 04 11:42 PM


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"