Protection

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I have a budget sheet which allows restricted access (users without
password can only update certain cells).

I want to be able to lock the sheet/unlock the sheet using buttons. I
have tried a Macro but after the first time it only protects the sheet
without a password.

Can any one tell me how to correct this without having to go to Tools,
Protection, etc etc every time as users might forget to do this.

Thanks
 
Private Sub SHEETPROTECT()
With ActiveSheet
.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
.EnableSelection = xlUnlockedCells
End With
End Sub

Private Sub SHEETUNPROTECT()
ActiveSheet.Unprotect Password:="justme"
End Sub

You will have to lock the project for viewing so's curious users cannot see the
code and password.


Gord Dibben MS Excel MVP
 
Back
Top