I am trying to unprotect all sheets in my workbook and I am having a hard time writing the code. I cannot seem to figure out what to put to 1. Select all worksheets, and 2. Unlock them. Can anyone help with this? Thank you very much!
Rick
maddog1978
03-28-2003, 04:00 PM
You can loop through the collection object of worksheets and unprotect each sheet.
====================================================
Dim ws As Worksheet
For Each ws In Worksheets
ws.Unprotect; "password"
Next
====================================================
Thanks Maddog, I'll give that a try when I get back to work. I'll post here to let you know if it worked for me. Thanks again,
Rick
Maddog,
I cannot figure out how to use this code that you gave me. Where do I put it? Thank you,
Rick
italkid
04-01-2003, 03:53 PM
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim password
password = "maddog1978"
For Each ws In Worksheets
ws.Unprotect password
Next
End Sub
In this example it works thru a button but you could put this code anywhere.