Private
Sub
Workbook_BeforeSave(
ByVal
SaveAsUI
As
Boolean
, Cancel
As
Boolean
)
Dim
wsTab
As
Worksheet
Dim
rngWerte
As
Range
Dim
rngFormeln
As
Range
Set
wsTab = Worksheets(
"Korrekturen"
)
On
Error
Resume
Next
With
wsTab
If
.ProtectContents =
True
Then
.Unprotect Password:=
"record"
With
.Range(
"A:X"
)
.Locked =
False
On
Error
Resume
Next
Set
rngWerte = .SpecialCells(xlCellTypeConstants)
Set
rngFormeln = .SpecialCells(xlCellTypeFormulas)
On
Error
GoTo
0
End
With
If
Not
rngWerte
Is
Nothing
Then
rngWerte.Locked =
True
If
Not
rngFormeln
Is
Nothing
Then
rngFormeln.Locked =
True
.Protect DrawingObjects:=
True
, Contents:=
True
, Scenarios:=
True
_
, AllowSorting:=
True
, AllowFiltering:=
True
, Password:=
"record"
End
With
End
Sub