Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    London, United Kingdom
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2000 (Protect sheet but allow autofilter)

    Hi there

    I am trying to protect a worksheet but still enable the autofilter. I have been using the following code:
    ActiveSheet.Protect contents:=True, userInterfaceOnly:=True
    however the autofilter is not enabled.
    any help with this would be much appreciated.

    Amanda

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: 2000 (Protect sheet but allow autofilter)

    Add the line:

    <pre>Activesheet.EnableAutoFilter = True</pre>


    Before protecting the worksheet

    Steve

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: 2000 (Protect sheet but allow autofilter)

    Since I said "before protecting" and you said "after protecting" is it safe to say it won't matter? <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Steve

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>It is "EnableAutoFilter" (correct in code) not "EnableAutoProtect" (as in your text)...

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: 2000 (Protect sheet but allow autofilter)

    Edited by HansV to correct error - thanks to Steve for pointing it out!

    After protecting the sheet, you must enable AutoFilter:

    ActiveSheet.EnableAutoFilter = True

    Note: the AutoFilter buttons must already be displayed - you cannot turn on AutoFilter once the sheet is protected. EnableAutoFilter only specifies whether the user can use the AutoFilter buttons.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: 2000 (Protect sheet but allow autofilter)

    Thanks, error corrected.

    As far as I can tell, it doesn't matter whether you set EnableAutoFilter to True before or after protecting the sheet.

Posting Permissions

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