+ Reply to Thread
Results 1 to 5 of 5

Protecting sheet with auto filter

  1. #1
    Registered User
    Join Date
    05-31-2010
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    88

    Protecting sheet with auto filter

    Hi! I have a workbook with an autofilter macro code on it. But whenever I protect it, the code would not work.

    Is there a way to protect a cell at the same time use the auto filter macro?

    Thanks!
    Last edited by geng; 09-05-2010 at 10:09 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Protecting sheet with auto filter

    Either when the workbook opens or when the macro runs, reapply the "protection" adding the UserInterfaceOnly flag. Once that is turned on, the sheet is protected from humans, but VBA is free to function on it as if it were not protected. Very convenient.

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Protecting sheet with auto filter

    Hello,

    in your code, you can unprotect the worksheet, run the filter code and then re-protect the worksheet.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-31-2010
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Protecting sheet with auto filter

    This is my autofilter code.

    How do i apply the code that you gave on this code?

    Please Login or Register  to view this content.
    Thanks!

  5. #5
    Registered User
    Join Date
    05-31-2010
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Protecting sheet with auto filter

    Quote Originally Posted by teylyn View Post
    Hello,

    in your code, you can unprotect the worksheet, run the filter code and then re-protect the worksheet.

    Please Login or Register  to view this content.
    Thanks teylyn!

+ 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