+ Reply to Thread
Results 1 to 5 of 5

Excel 2013 unProtect/Protect much slower

  1. #1
    Registered User
    Join Date
    06-11-2010
    Location
    Windsor, Canada
    MS-Off Ver
    Excel 2007
    Posts
    55

    Question Excel 2013 unProtect/Protect much slower

    Excel 2013 Unprotect and Protect is much slower. All over VBA code in a spreadsheet where I have many worksheets I protect and unprotect all specified worksheets instead of protecting a specific sheet. Each individual subroutine may recall the same two processes. How do I correct the slowness without having to remove this code all together and trying to change the code to just protect specific individual sheets.

    Here is the code. Microsoft said for 2013 they are fixing the problem so take all this logic out. Has anyone experienced this issue and what did you do?

    Please Login or Register  to view this content.
    cmwilbur

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: Excel 2013 unProtect/Protect much slower

    Whatever version of Excel you are using, unprotecting and protecting all worksheets in order to work on one probably isn't the most efficient way of working.

    I would suggest that you either use .Protect UserInterfaceOnly:=True for each sheet. You would need to apply the setting in the Workbook Open event handler.

    Alternatively, amend the subroutine to operate on only one worksheet and pass it the worksheet, or worksheet name, as a parameter.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-11-2010
    Location
    Windsor, Canada
    MS-Off Ver
    Excel 2007
    Posts
    55

    Re: Excel 2013 unProtect/Protect much slower

    Is difficult to always protect a single sheet. We did this mass sheet protect/unprotect logic because in many cases we wanted to be able to update multiple sheets and we did not have the information up front. May be clearing all the data on all the individual worksheets for a new fiscal year. We may be resetting data on all the individual worksheets from processed to unprocessed. Most of the cases I guess I could change the logic to unprotect/protect a specific sheet because in most cases I know which sheet is being processed. But in a few cases we need to keep the unprotect/protect all sheets. Will change it wherever I can but some special processes I cannot change the protection. We use this spreadsheet to do our Food Services Invoice processing for many different accounts. Each account is a different worksheet within the spreadsheet.

    Hopefully this might speed up the process wherever possible. Won't be perfect but will be better than it is in 2013. Not a problem at all before 2013.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: Excel 2013 unProtect/Protect much slower

    If you use UserInterfaceOnly, and set it in the Workbook Open event handler, your code can operate on protected sheets, but users cannot.

    You would be able to remove all protect and un-protect code.

    Tedious, but perhaps a worthwhile exercise, given that you have to do something anyway.

    Perhaps make a copy of the workbook and test this approach and see if it improves performance.

    Regards, TMS

  5. #5
    Registered User
    Join Date
    10-26-2010
    Location
    Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Excel 2013 unProtect/Protect much slower

    Another idea is to use:

    If Not Sht.ProtectContents then Sht.Protect Password:= MyPwd

    And

    If Sht.ProtectContents then Sht.Unprotect Password:= MyPwd

    These two lines will only protect sheets if they are not already protected, and unprotect sheets if they are not already unprotected, thus saving time protecting and unprotecting sheets when it is not necessary. :-)

    Edit: Oops I just realized you're already using this trick, in which case the tips above should help.
    Last edited by Kelvin Stott; 02-25-2015 at 11:36 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel 2013 - Protect Range of Cells without using Protect Sheet Button
    By caf20012 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-23-2014, 04:50 AM
  2. Excel 2013 issues with Worksheet Protect in VBA
    By Kraglin1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2013, 04:57 PM
  3. Excel macro getting slower and slower.
    By swoop99 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-24-2011, 06:41 AM
  4. VBa code to unprotect and protect the excel sheet
    By Blue_Wings in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-02-2010, 02:09 PM
  5. Problem using protect/Unprotect in excel 97
    By spyrule in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2006, 05:05 PM

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