Excel Protection

  • Thread starter Thread starter Jamess
  • Start date Start date
J

Jamess

I have set up an excel spread sheet and have used the data group an
outline function to group rows together.
.However when I choose sheet protection I am unable to use the grou
and outline function.
I also need to protect certain cells within the document, whil
allowing users to edit pther ranges.


Any suggestions gratefully recieve
 
Hi james

Right click on the Sheet Name Tab and select "View Code" and paste in
the code below


Private Sub Worksheet_Activate()
Me.Protect Password:="Secret", UserInterfaceOnly:=True
Me.EnableOutlining = True
End Sub

Change "Secret" to your password, or take out the: Password:="Secret",

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Another way is to use the code below, also placed in the Private Module
of the Sheet Object.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Address = "$A$1" Then
Me.Unprotect Password:="Secret"
Else
Me.Protect Password:="Secret"
End If
End Sub


This will unprotect the sheet but only while the Active Cell is A1

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Don't know how important this exception is, but if A1 is selected, then
the range A1:J10 selected, the sheet remains unlocked.
 
Back
Top