You must have the Data>Group and Outline area pre-set.
Then you add event code to the worksheet module.
Private Sub Worksheet_Activate()
With Me
.Protect Password:="justme", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub
This will allow showing and hiding detail on a protected sheet.
Gord Dibben MS Excel MVP