+ Reply to Thread
Results 1 to 4 of 4

Range.Autofilter not working on protected sheet

  1. #1
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    Sunderland, England
    MS-Off Ver
    Excel 2007 (Home) / 2003 (Work)
    Posts
    740

    Range.Autofilter not working on protected sheet

    Hi

    I have a protected sheet that has an autofilter applied to it on range A2:G5000. 'Use Autofilter' is selected in the Protect Sheet dialog box, and I can manually use the autofilters without a problem.

    However, in my code I was having some issues with the Freeze Panes aspect, so I recorded myself removing freeze panes and adding it again, and with a bit of tinkering came up with the following:

    Please Login or Register  to view this content.
    This works fine when the sheet is not protected, but even though I can manually do this process fine with a protected sheet, I get a runtime 1004 error at the first line above advising me 'You cannot use this command on a protected sheet'. I can't just unprotect the sheet as this will be a shared spreadsheet.

    Any ideas why this might be happening?

  2. #2
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Range.Autofilter not working on protected sheet

    Try;

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    Sunderland, England
    MS-Off Ver
    Excel 2007 (Home) / 2003 (Work)
    Posts
    740

    Re: Range.Autofilter not working on protected sheet

    Thanks for the response Blokeman - however I can't unprotect the sheet as this will be a 'Shared' workbook.

    When I perform the steps manually I don't need to unprotect the sheet anyway, that's what confuses me. I can't understand why I can perform an operation on the sheet manually but I can't do exactly the same thing with VBA. I can record myself doing it (and it works fine) then as soon as I step through the recorded macro I get the same error.

  4. #4
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    Sunderland, England
    MS-Off Ver
    Excel 2007 (Home) / 2003 (Work)
    Posts
    740

    Re: Range.Autofilter not working on protected sheet

    Hate to bump, but this is still killing me so I thought I'd give it one more shot - any ideas anyone?

+ 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] Autofilter on a protected sheet
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-20-2012, 12:33 PM
  2. Protected Sheet & Allow Use Of Autofilter
    By winnie_shrub in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-27-2007, 04:47 AM
  3. Use Autofilter in Protected sheet
    By swapnasetty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2007, 10:02 AM
  4. [SOLVED] Autofilter in protected workbook not working
    By Rumpa Biswas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-27-2006, 12:35 PM
  5. Autofilter protected sheet
    By vecia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-10-2005, 03:25 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