Private
Sub
Kennwortschutz()
On
Error
GoTo
Fehler
If
ActiveSheet.ProtectContents =
False
Then
GoTo
Fehler
ActiveSheet.Unprotect
CommandButton2.Visible =
True
CommandButton3.Visible =
True
CommandButton4.Visible =
True
Exit
Sub
Fehler:
ActiveSheet.Protect DrawingObjects:=
True
, Contents:=
True
, Scenarios:=
True
_
, AllowSorting:=
True
, AllowFiltering:=
True
, Password:=(
"KdoSAN"
)
CommandButton2.Visible =
False
CommandButton3.Visible =
False
CommandButton4.Visible =
False
On
Error
GoTo
0
End
Sub