Microsoft Excel - Attempting to expand grouped cells also edit object in locked sheet

Asked By Phil Phillip on 03-Jan-18 07:44 PM

I have a spreadsheet in Excel 2010 with grouped cells and numerous locked cells. I need to be able to insert comments into unlocked cells and expand and contract grouped cells within the locked spreadsheet.  I have tried the following VBA code which allows for the expanding and contracting but does not let me insert comments.

Option Explicit

Private Sub Workbook_Open()

Sheets("2018").Unprotect Password:="Panadol1"

With Sheets("2018")

.Protect Password:="Panadol1", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingCells:=False, AllowFormattingColumns:=False, AllowFormattingRows:=False, userinterfaceonly:=True

.EnableOutlining = True

.EnableAutoFilter = True

End With

End Sub

Any help would be greatly appreciated.