Protection

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
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top