+ Reply to Thread
Results 1 to 4 of 4

All Worksheets pw protect with Auto Filter

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    All Worksheets pw protect with Auto Filter

    Hi

    Please may I ask advice on how to write this code to protect all sheets ...

     For Each ws In ThisWorkbook.Worksheets
       ws.Protect Password:="xx"
       ws.ProtectDrawingObjects = False
       ws.AutoFilter = True
       ws.Contents = True
       ws.Scenarios = True
       
     Next ws
    Much appreciated!

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: All Worksheets pw protect with Auto Filter

    Try this
    Private Sub CommandButton3_Click()
    Dim WS As Worksheet
    
    For Each WS In ThisWorkbook.Worksheets
        WS.Protect AllowFiltering:=True
    Next WS
    End Sub
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: All Worksheets pw protect with Auto Filter

    Worked - thank you!!

    Erm ... where do I find the SOLVED button *blush*

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: All Worksheets pw protect with Auto Filter

    No blushing required.
    Click on Thread Tools in your original post then click Solved.
    Thank you very much for the rep!

+ 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] Macro: Protect All Sheets, but allow Auto Filter on all
    By BLS99covert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2015, 12:17 AM
  2. Auto hide & protect worksheets before closing
    By magnum206 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-11-2014, 08:32 PM
  3. Unprotect, auto filter, and protect again
    By Khowailedg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2013, 02:02 PM
  4. Applying Table Auto Filter to Multiple worksheets in a single Workbook
    By csivell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 02:22 PM
  5. Combobox - Filter auto-filter worksheets (ActiveX)
    By Darms in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2011, 11:33 AM
  6. Apply Auto Filter in selective worksheets and Copy to new workbook
    By mclav in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-07-2011, 01:27 AM
  7. Auto-Filter on multiple worksheets automatically via VBA
    By GLT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2005, 04:45 PM

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