Event macro unprotects worksheet, then changes protection parameters - not what I want.
Posted on 2014-08-08
I use the following code to unprotect a worksheet and delete a row, retaining formulas and formats, but deleting constants, then turning protection on again..
The problem is that I want to allow users of the protected worksheet to 'Select Unlocked Cells,' 'Select Locked Cells,' 'Format Cells,' but when the macro turns protection back on, the ability to format goes away, and all they can do is Select the unlocked and locked cells.
How can I lock in my protection parameters? (Disclaimer - I know very little, and have gotten this far by getting help here and by searching the web.)
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'David McRitchie, 2007-09-07 insrtrow.htm on double-click
'-- will copy more often than Extend Formulas and Format (tools option)
Cancel = True
If Target.Row < 24 Then Exit Sub
Cells(Target.Row + 1, 1).EntireRow.Insert
Cells(Target.Row + 1, 1).EntireRow.Select
Application.CutCopyMode = False
On Error Resume Next
'-- customize range for what cells constants can be removed --
On Error GoTo 0