Protection

Home Search Site Map

Up
Add-Ins...
AutoCorrect Options...
Compare & Merge...
Customize...
Error Checking...
Formula Auditing
Goal Seek...
Macro
Online Collaboration
Options...
Protection
Research...
Scenarios...
Shared Workspace...
Share Workbook...
Speech
Spelling...
Track Changes

New! Excel User Group Now Open @ www.excelusergroup.org, Check It Out!


Menu command Type What happens next?

Protection

Protection has four sub menus as detailed below

Protect Sheet...

Protection of data on worksheets is a two-stage process in Excel. The first part takes place under the menu option Format>Cells...>Protection

Allow Users to Edit Ranges.....

This is a new setting in Excel 2003 which allows very fine control over who can edit certain ranges within a workbook. Clucking on the menu gives the dialog below.

In this you can add certain ranges, whena  sheet is protected into which users require a password to edit, so you could protect the entire sheet, but allow certain users, by password to edit certain cells. Here we have a range called 'Range1' set up to cover $A$1:$A$11 (Obviously on the sheet that is protected). If we click on 'New...', you get the dialog below allowing you to set up the range and a password.

Pressing the 'Permissions...' button allows even more complexity and 'tuning' by specifying the users who are allowed to edit the range. You receive the dialog below, which has a sub-dialog under the  Add... button, to search for and select certain users/groups.

Checking the 'paste permissions information into a new workbook' option in the top dialog, allows you to transfer all the data of users and the various permissions to a new workbook for record purposes, like so:

Protect Workbook...

Has a dialog as below and enable you to protect the workbook 'structure', that is users cannot move or hide sheets, unhide them, etc. and protect the workbook 'windows' meaning the workbook will open with the window size and position exactly as you set, they cannot be moved.  A password is provide to stop users from changing these settings.

Protect and Share Workbook...

This setting not only allows the workbook to be shared between users, you can also track the changes made in the workbook. The first dialog, below, allows you to set up the sharing, with change tracking and a password to prevent users switching sharing or any of the other options back off/on.

After confirming the password, you will be asked to save the file to a new name/location to make it a 'share'. The file can now be opened and edited by multiple users at one time.

VBA Sub SetUpAnEditableRange()
Dim sht As Worksheet
Dim wb As Workbook
Dim ptct As Protection
Dim AllER As AllowEditRange
Dim usr As UserAccess
Set wb = ActiveWorkbook
Set sht = wb.ActiveSheet
'Unlock cells A1:A100
sht.Range("A1:A100").Locked = False
'Set up a Protect object on the worksheet
Set ptct = sht.Protection
'Set up an AllowEditRange object
'Named Range10 covering a range C1:C100 with a password
Set AllER = ptct.AllowEditRanges.Add("Range10", Range("C1:C100"), "abc")
'set a user access object
Set usr = AllER.Users.Add("Nick Hodge", True)
'Protect workbook
sht.Protect Password:="abc", AllowSorting:=True, AllowFiltering:=True
End Sub
 

Sub protectSheetAndBook()
Dim sht As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook
Set sht = wb.ActiveSheet
'Protect workbook structure and windows
wb.Protect Password:="abc", Structure:=True, Windows:=True
'Protect sheet with default setting and no password
sht.Protect
End Sub
 

Sub ShareWorkbook()
Dim wb As Workbook
Set wb = ThisWorkbook
wb.ProtectSharing Filename:="C:\Shared.xls", _
Password:="abc", SharingPassWord:="abc"
wb.KeepChangeHistory = True
End Sub

Top

Copyright Nick Hodge 2008. All Rights Reserved.