Worksheets are protected, ranges are locked. You have named a range object in a confusing manner so it looks like it would be a worksheet object. EnableOutlining is also a worksheet property, that will error as well.
You need to unlock all the cells you want to modify and lock those you want to be immutable.
This should do what you are looking for:
Sub allowGroup()
Dim lockrange As Range
Set lockrange = Range("A1:S23,P26:S53,B38:O38,B53:O53")
ActiveSheet.EnableOutlining = True
Range(Cells.Address).Locked = False
lockrange.Locked = True
Dim myPW As String
myPW = Application.InputBox("Type one Password to protect your worksheet:", "allowGroup", "", Type:=2)
ActiveSheet.Protect Password:=myPW, Userinterfaceonly:=True
End Sub
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…