+ Reply to Thread
Results 1 to 8 of 8

autofilter and worksheet protection

  1. #1
    Registered User
    Join Date
    08-19-2005
    Posts
    58

    autofilter and worksheet protection

    for some reason, excel gives me the following error when i try to execute an autofilter command on a protected worksheet:

    run-time error '1004':

    you cannot use this command on a protected sheet. etc. etc.
    even though i set "allow all users of this worksheet to: use autofilter" in the options dialog. does it not apply to vba?

  2. #2
    Ron de Bruin
    Guest

    Re: autofilter and worksheet protection

    Hi dreamz

    Before you protect the sheet turn on AutoFilter

    See also
    http://www.contextures.com/xlautofilter03.html#Protect


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "dreamz" <[email protected]> wrote in message
    news:[email protected]...
    >
    > for some reason, excel gives me the following error when i try to
    > execute an autofilter command on a protected worksheet:
    >
    >>
    >> run-time error '1004':
    >>
    >> you cannot use this command on a protected sheet. etc. etc.

    >
    > even though i set "allow all users of this worksheet to: use
    > autofilter" in the options dialog. what's wrong?
    >
    >
    > --
    > dreamz
    > ------------------------------------------------------------------------
    > dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
    > View this thread: http://www.excelforum.com/showthread...hreadid=535565
    >




  3. #3
    Registered User
    Join Date
    08-19-2005
    Posts
    58
    the filter has already been created on the sheet and, since i'm using excel 2003, i checked the "autofilter" option in the dialog. it still does not work.

  4. #4
    William Horton
    Guest

    RE: autofilter and worksheet protection

    Protect the sheet with userinterface only turned on. Then in the visual
    basic editor for that worksheet's property box ensure that enable autofilter
    is set to True. To protect with userinterface only has to be done via a
    macro but it only has to be done once and then you can get rid of the macro.
    Press Alt & F11 to get to the visual basic editor.

    ThisWorkbook.ActiveSheet.Protect userinterfaceonly:=True

    "dreamz" wrote:

    >
    > for some reason, excel gives me the following error when i try to
    > execute an autofilter command on a protected worksheet:
    >
    > >
    > > run-time error '1004':
    > >
    > > you cannot use this command on a protected sheet. etc. etc.

    >
    > even though i set "allow all users of this worksheet to: use
    > autofilter" in the options dialog. what's wrong?
    >
    >
    > --
    > dreamz
    > ------------------------------------------------------------------------
    > dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
    > View this thread: http://www.excelforum.com/showthread...hreadid=535565
    >
    >


  5. #5
    Registered User
    Join Date
    08-19-2005
    Posts
    58
    thanks, william. worked like a charm!

  6. #6
    Ron de Bruin
    Guest

    Re: autofilter and worksheet protection

    Hi dreamz

    Do you filter with code or manual

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "dreamz" <[email protected]> wrote in message
    news:[email protected]...
    >
    > the filter has already been created on the sheet and, since i'm using
    > excel 2003, i checked the "autofilter" option in the dialog. it still
    > does not work.
    >
    >
    > --
    > dreamz
    > ------------------------------------------------------------------------
    > dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
    > View this thread: http://www.excelforum.com/showthread...hreadid=535565
    >




  7. #7
    Ron de Bruin
    Guest

    Re: autofilter and worksheet protection

    See also the code on Debra's site in my reply

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "dreamz" <[email protected]> wrote in message
    news:[email protected]...
    >
    > thanks, william. worked like a charm!
    >
    >
    > --
    > dreamz
    > ------------------------------------------------------------------------
    > dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
    > View this thread: http://www.excelforum.com/showthread...hreadid=535565
    >




  8. #8
    Registered User
    Join Date
    08-19-2005
    Posts
    58
    i filter with code.

    everything works well now. my only remaining question is this: how can i disable cell selection with the userinterfaceonly code? i want to make it so that the end-user can click only those cells that i designate.

    edit: i added .enableselection and it works.
    Last edited by dreamz; 04-24-2006 at 04:33 PM.

+ 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