excel worksheet protection with exceptions

  • Thread starter Thread starter Danodob
  • Start date Start date
D

Danodob

I have a 50+ sheet workbook that I need to password protect with a macro.
Unfortunately, I need to have exceptions for hyperlinks along with autosort
and autofilter among others. I have found answers for autofilter on this
site but no luck with the others. I am using the following code to protect:

Private Sub CommandButton1_Click()

Dim wSheet As Worksheet

For Each wSheet In Worksheets

If wSheet.ProtectContents = True Then

wSheet.UnProtect Password:=TextBox1.Text

Else

wSheet.Protect Password:=TextBox1.Text

End If

Next wSheet

Unload Me

End Sub


Any help would be greatly appreciated.

Thank you in Advance,

Dan
 
Dan,

The focus of this newsgroup is macros in Access, the database programme.
You will have a better chance of a good answer if you re-post your
question to an Excel related newsgroup.
 

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

Back
Top