Automatically Protect/UnProtect All Worksheets

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.

This entry was posted in Workbook and Worksheet and tagged , , , , , , , . Bookmark the permalink.

1,776 Responses to Automatically Protect/UnProtect All Worksheets

  1. Pingback: http://www.webstatschecker.com/stats/keyword/028229

  2. Pingback: makeup coupons 2012

  3. Pingback: Rental Real Estate Income

  4. Pingback: rabbit vibrator

  5. Pingback: internet business ideas

  6. Pingback: ketone weight loss

  7. Pingback: scentsy

  8. Pingback: Estate Planning Trusts

  9. Pingback: got milk?

  10. Pingback: asian escorts perth

  11. Pingback: go there

  12. Pingback: website

  13. Pingback: address

  14. Pingback: click here

  15. Pingback: payday loans

  16. Pingback: anti bullying school programs

  17. Pingback: tumbshots

  18. Pingback: Symbol LS 4208 handheld laser barcode scanner

  19. Pingback: houston power

  20. Pingback: servis char

  21. Pingback: www

  22. Pingback: promoting and celebrating Virginia creativity

  23. Pingback: family medical insurance plan

  24. Pingback: duluth tree removal

  25. Pingback: Red Wines

  26. Pingback: apex merchant group careers

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>