+ Reply to Thread
Results 1 to 3 of 3

Allow group ungroup and auto filter in a protected sheet

  1. #1
    Registered User
    Join Date
    02-20-2019
    Location
    New Zealand
    MS-Off Ver
    2010
    Posts
    3

    Allow group ungroup and auto filter in a protected sheet

    Hi, I have google and tried a few vba code formulas but i'm not having much luck. I have a worksheet with the top row filtered and multiple grouped rows. I seem to have enabled grouping when the sheet is protected. But the autofilter - it works after i have protected the sheet and am still working on it, but after closing it when i open it again the Auto filter no longer works. I am a dummy when it comes to anything like this and don't understand the code at all so if someone is able to help i would be very grateful. Thanks - Hamish

  2. #2
    Registered User
    Join Date
    02-20-2019
    Location
    New Zealand
    MS-Off Ver
    2010
    Posts
    3

    Re: Allow group ungroup and auto filter in a protected sheet

    Hi, the following is what I have managed to work out so far:

    1. Group/Ungroup in a protected sheet - the following code works inserted into ThisWorkbook, but not in a Module

    Private Sub Workbook_Open()
    Dim wsh As Worksheet
    For Each wsh In Me.Worksheets
    wsh.EnableOutlining = True
    wsh.Protect UserInterfaceOnly:=True
    Next wsh
    End Sub

    2. Autofilter in a protected sheet - the following code works inserted into ThisWorkbook, but not in a Module. I can also Autofilter without the code altogether by simply ticking the Autofilter tick box when protecting the sheet.

    Private Sub Workbook_Open()
    Dim wsh As Worksheet
    For Each wsh In Me.Worksheets
    wsh. EnableAutoFilter = True
    wsh.Protect UserInterfaceOnly:=True
    Next wsh
    End Sub

    The problem I can't solve is that I want to enable BOTH Group/Ungroup AND Autofilter in a protected sheet - this is what i need help with please. I can get each of these working individually but I can't get both to work at the same time. Is there a code that will enable both?

    Would really appreciate some help with this. Thanks in advance - Hamish.

  3. #3
    Registered User
    Join Date
    02-20-2019
    Location
    New Zealand
    MS-Off Ver
    2010
    Posts
    3

    Re: Allow group ungroup and auto filter in a protected sheet

    Hi again. I finally solved it - to enable BOTH group/ungroup AND autofilter I combined both the above codes into one and entered it into the "ThisWorkbook" window and it works. The code I used is below:

    Private Sub Workbook_Open()
    Dim wsh As Worksheet
    For Each wsh In Me.Worksheets
    wsh. EnableAutoFilter = True
    wsh.EnableOutlining = True
    wsh.Protect UserInterfaceOnly:=True
    Next wsh
    End Sub

    Happy days!
    Hamish.

+ 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. Enable Group/Ungroup in protected sheet
    By UzairHakim in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2013, 08:11 AM
  2. [SOLVED] Group/Ungroup in a Protected Sheet
    By ExcelManager01 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-21-2013, 10:39 AM
  3. Group/Ungroup with sheet protected
    By robrobet in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2013, 03:52 PM
  4. [SOLVED] Using Group and Ungroup on multiple sheet when password protected
    By RandyD123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2013, 08:12 AM
  5. need to ungroup and group rows while sheet is protected
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-29-2010, 11:55 AM
  6. Group/ungroup columns in protected sheet
    By bobens_83 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2008, 10:36 AM
  7. Protected Sheet (Group/Ungroup)
    By Merlin54k in forum Excel General
    Replies: 5
    Last Post: 05-14-2007, 03:39 AM
  8. [SOLVED] Group/Ungroup with sheet protected
    By Holt88 in forum Excel General
    Replies: 4
    Last Post: 02-17-2006, 06:10 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