PDA

View Full Version : Enable Grouping Or Outline Or Outlining On A Protected Excel Worksheet



Excel Fox
03-29-2013, 08:56 PM
A lot of times we come across situations where we need to use the Grouping / Outlining feature in Excel, but at the same time we want to protect the sheet too. Excel doesn't provide an option to do this via the sheet protection window that pops up while protecting a sheet. However, this can easily be achieved using VBA. Here's how (paste it in a module)


Private Sub Auto_Open()

Dim wks As Worksheet

For Each wks In Worksheets
With wks
.Protect Password:="YourPassWordHERE", UserInterfaceOnly:=True
.EnableOutlining = True
End With
Next wks

End Sub

paul_pearson
08-15-2013, 01:09 AM
Hi Excel Fox

Used the code below but still asks to unprotect sheet otherwise does not work




Private Sub Auto_Open()

Dim wks As Worksheet

For Each wks In Worksheets
With wks
.Protect Password:="YourPassWordHERE", UserInterfaceOnly:=True
.EnableOutlining = True
End With
Next wks

End Sub