Protection using the subtotal function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to protect a worksheet and still be able to use the subtotal
(grouping and ungrouping) function in excel? I need to protect a document but
be able to allow others to group/ungroup the data. Can this be done? Thanks,
 
Yes, it is possible with VBA. Copy the following code into a VBA module in
the workbook. Edit the sheet name ("Sheet1") and password ("hi") as
appropriate.

Option Explicit

Sub Auto_Open()
With Worksheets("Sheet1")
.Protect Password:="hi", UserInterfaceOnly:=True
.EnableSelection = xlNoSelection
.EnableOutlining = True
.EnableAutoFilter = True
End With
End Sub

Hope this helps,

Hutch
 
Back
Top