Macro to Protect Mult Sheets / but allow Pivot Tables...

C

Chris

Hello Group,

I have this code that i found in searching the forums, but i have a
question. I need to allow them to access two unlocked cells and a
pre-exsisting pivot table. I want to lock the rest of the sheet. Can someone
else me improve this code please? :)

Sub LockEm()
Dim i As Long
Dim PW As String
Dim WS As Worksheet
PW = InputBox("Password:")
On Error GoTo MyErr
For Each WS In ActiveWorkbook.Worksheets
WS.Protect (PW)
Next
MsgBox i & " errors while protecting", vbInformation
Exit Sub
MyErr:
i = i + 1
Resume Next
End Sub

Thank you.
 

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