+ Reply to Thread
Results 1 to 3 of 3

Auto-Protect multiple Sheets on closing?

  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question Auto-Protect multiple Sheets on closing?

    I tried to use this code by adding lines of the same code and change it to the 15 sheets I have in one workbook, but it did not work. I had used the information from another user found here http://www.excelforum.com/excel-prog...74#post3296074 but it did not work for my multiple sheets. Could you please help?

    An example of what I did below (but I created the code for 15 sheets):

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Auto-Protect multiple Sheets on closing?

    Your code is ok - what you'll probably find is that some of the worksheets are already password protected.

    You can use On Error Resume Next to get by that or you can test for protection and make it conditional

    If ThisWorkbook.Worksheets("sheet1").ProtectContents = False Then ThisWorkbook.worksheets("sheet1").Protect Password:="ABC1"
    Last edited by AndyLitch; 06-27-2013 at 10:05 AM.
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    06-25-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Auto-Protect multiple Sheets on closing?

    Thanks Andy. Should the On Error Resume Next be placed before and after the initial command? Sorry, I am a little rusty with these codes

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1