Tonight I want to automatically protect and unprotect all Microsoft Excel Worksheets in my Workbook with password, instead of doing it manually, I put these following Excel VBA macro code in my Workbook.
Public Sub ProtectAllSheets()
Dim objSheet As Worksheet
'Protecting all worksheets with password
For Each objSheet In Worksheets
If objSheet.ProtectContents = False Then objSheet.Protect "a@#&ladfl&^"
Next objSheet
End Sub
Public Sub UnProtectAllSheets()
Dim objSheet As Worksheet
'UnProtecting all worksheets with password
For Each objSheet In Worksheets
If objSheet.ProtectContents = True Then objSheet.Unprotect "a@#&ladfl&^"
Next objSheet
End Sub
We only need to call the procedure ProtectAllSheets to protect with password all Excel Worksheets in our Workbook, and calling UnProtectAllSheets will reversed the effect.
Pingback: http://www.webstatschecker.com/stats/keyword/028229
Pingback: makeup coupons 2012
Pingback: Rental Real Estate Income
Pingback: rabbit vibrator
Pingback: internet business ideas
Pingback: ketone weight loss
Pingback: scentsy
Pingback: Estate Planning Trusts
Pingback: got milk?
Pingback: asian escorts perth
Pingback: go there
Pingback: website
Pingback: address
Pingback: click here
Pingback: payday loans
Pingback: anti bullying school programs
Pingback: tumbshots
Pingback: Symbol LS 4208 handheld laser barcode scanner
Pingback: houston power
Pingback: servis char
Pingback: www
Pingback: promoting and celebrating Virginia creativity
Pingback: family medical insurance plan
Pingback: duluth tree removal
Pingback: Red Wines
Pingback: apex merchant group careers