+ Reply to Thread
Results 1 to 6 of 6

Strange issue with VBA for protection and filtering - VBA need to be in THISWORKBOOK???

  1. #1
    Registered User
    Join Date
    09-20-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    98

    Strange issue with VBA for protection and filtering - VBA need to be in THISWORKBOOK???

    I have a macro which runs through certain sheets and filters them, which then updates a dashboard.

    This works fine if the protection coding sits in the THISWORKBOOK module, however really slows the loading of the whole file.

    I tried setting up the same code as a separate macros which runs as a one to protect each sheet. However when I next open the workbook the filter buttons fail. When I put it back into THISWORKBOOK all works again.

    I would rather this didn't have to run every time on opening. Any ideas?


    Please Login or Register  to view this content.

  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,425

    Re: Strange issue with VBA for protection and filtering - VBA need to be in THISWORKBOOK??

    UserInterFaceOnly:=True is not remembered/retained between sessions. Consequently you will HAVE to have it as part of the Workbook Open event handler.

    The only alternative is to Unprotect and Protect the worksheets on an ad hoc basis. Must admit, that's the way that I tend to do it anyway.

    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
    09-20-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    98

    Re: Strange issue with VBA for protection and filtering - VBA need to be in THISWORKBOOK??

    Does UserInterFaceOnly:=True have to be set per worksheet or can it be set for a whole workbook on opening?

  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,425

    Re: Strange issue with VBA for protection and filtering - VBA need to be in THISWORKBOOK??

    Each worksheet ... it's part of the protection options for the sheet, not the workbook.

  5. #5
    Registered User
    Join Date
    09-20-2014
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    98

    Re: Strange issue with VBA for protection and filtering - VBA need to be in THISWORKBOOK??

    Thanks for you reply

  6. #6
    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,425

    Re: Strange issue with VBA for protection and filtering - VBA need to be in THISWORKBOOK??

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. [SOLVED] Strange issue with VBA for protection and filtering - not what you think!
    By dazbear in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2015, 05:15 PM
  2. ThisWorkbook macro issue not running
    By b_rianv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2014, 07:16 PM
  3. Export worksheet and ThisWorkbook.Path issue
    By jwagman1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2012, 06:36 PM
  4. [SOLVED] Strange worksheet protection behavior
    By Patrick Simonds in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-30-2006, 08:10 PM
  5. [SOLVED] Strange Worksheet Protection
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2005, 04:05 AM

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