Unprotecting Outlining

Corleone

Well-known Member
Joined
Feb 2, 2003
Messages
836
Office Version
  1. 365
Hi
I have a protected sheet in my workbook
I am able to unprotect the filtering however i dont seem to be able to unprotect the outlining.

I tried assigning the code below to it but it s not working
Any Ideas?
Thanks

----------------------------------------------------------------------------------------------------------------------------------------

Option Explicit

Private Sub worksheet_activate()

With ActiveWorkbook.Sheets("update")
Sheets("UPDATE").Select
Rows("1:1").Select
Worksheets("UPDATE").Unprotect "HORSE"


Range("B1").Select
Worksheets("UPDATE").Protect "HORSE", AllowFiltering:=True, userInterfaceonly:=True
ActiveSheet.EnableOutlining = True


End With
End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
The code needs to be in the worksheet code module for that sheet - is that where it is? It can also be simplified to:

VBA Code:
Option Explicit

Private Sub Worksheet_Activate()
With Me
   .Unprotect "HORSE"
   .EnableOutlining = True
   .Protect "HORSE", AllowFiltering:=True, userInterfaceonly:=True
End With
End Sub

Note that this will only allow you to use existing outlines, not create new ones.
 
Upvote 0
Solution
Thanks Rory
Yes, the code is assigned to the specific sheet
I have replaced it with your code but the issue still remains
 
Upvote 0
Assuming you have verified that the code is actually running (you will need to activate another sheet, then switch back to the relevant sheet), can you confirm that you are simply trying to use an existing outline, not add a new one?
 
Upvote 0
Assuming you have verified that the code is actually running (you will need to activate another sheet, then switch back to the relevant sheet), can you confirm that you are simply trying to use an existing outline, not add a new one?
Its working now - Thanks - i just had to do as you said above and click on another sheet then back to this one
Thanks
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,519
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top