Results 1 to 4 of 4

Protected Worksheet w/AutoFilters

Threaded View

  1. #1
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Protected Worksheet w/AutoFilters

    Hi,

    I'm getting a 1004 Run time Error on the attached Workbook. I've added Worksheet protection to each Worksheet. I get an error on the 'WEAPS_QUAL_RPTS' worksheet when I run a "Clear Filter" Macro assigned to the button on the same sheet.

    The Attached file is an .xlsb version to reduce size. The Sheet Protection Password is: Admin

    WEAPS_RPTS_MISC Module Code (the line highlighted in bold is where I get the error in question.)
    Sub WeapQualRpt_ClearFilter()
    With Sheet9
        'Sheet6.Range("AI3:AH3").ClearContents
        .Range("E28").Value = "[Enter Event Type]"
        .Range("F6").Value = "[Enter Last Name]"
        .Range("G6").Value = "[Enter First Name]"
        .Range("H6").Value = "[All]"  'All Duty Sections
        .Range("I6").Value = "[All]"  'SRF-B Completions
        .Range("J6").Value = "[All]"  'SRF-A Completions
        .Range("BX2:BY2").Value = "" 'All 9MM Expiration dates
        .Range("CG2:CH2").Value = "" 'All M16 Expiration dates
         If ActiveSheet.AutoFilterMode Then
                .AutoFilter.ShowAllData
                .AutoFilterMode = False
         End If
    End With
    WeaponsRpt_Table 'Run Events Refresh Macro
    End Sub
    ProtectAll_UnProtectAll Module
    Sub Protect_All()
        Dim ws As Worksheet
        'turn screen updating off
        Application.ScreenUpdating = False
        'loop through the sheets
        For Each ws In ActiveWorkbook.Worksheets
            ws.Protect Password:="Admin", DrawingObjects:=False, Contents:=False, Scenarios:=True, _
                       AllowFormattingCells:=False, AllowDeletingColumns:=False, AllowDeletingRows:=False, _
                       AllowFiltering:=True, UserInterfaceOnly:=True
        Next ws
        Application.ScreenUpdating = True
    End Sub
    Additionally, I was hoping to protect the Cells in the Table be protected from editing but allow for selection (I have conditional formatting to highlight selected row.)

    Thank you in advance for reading my post.
    V/r,
    Jim
    Last edited by sorensjp; 05-24-2019 at 02:13 AM. Reason: Added an Attachment

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Enabling vba-autofilters on a protected AND shared workbook
    By salsalex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2014, 09:57 PM
  2. Script/Macro to Sort Protected Cells with AutoFilters
    By cabenjam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2012, 12:34 AM
  3. Copy and paste insert rows with protected cells in protected worksheet
    By excel_gecko in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-24-2012, 05:50 PM
  4. Code for Using Autofilters on Protected Workbooks
    By marktaylor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-14-2008, 08:26 AM
  5. Allowing autofilters on protected workbooks
    By Mulllet in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-23-2007, 08:03 AM
  6. Autofilters on protected worksheet
    By RJSohn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-06-2006, 11:57 PM
  7. Autofilters on a protected sheet
    By szl1194 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-16-2005, 08:16 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