Sub BlattSchutz()
' kennwort Makro
' Tastenkombination: Keine
Dim myPwd As String, myPwd2 As String
Dim wks As Worksheet
myPwd = Application.InputBox("Passwort eingeben")
myPwd2 = Application.InputBox("Wiederholung")
If myPwd2 = myPwd Then
For Each wks In ActiveWorkbook.Worksheets
wks.Protect Password:=myPwd, DrawingObjects:=True, _
Contents:=True, Scenarios:=True, AllowFormattingCells:=True, _
AllowFormattingColumns:=True, AllowFormattingRows:=True
Next wks
Else
MsgBox "Passwort falsch"
End If
End Sub
Sub BlattSchutz()
' kennwort Makro
' Tastenkombination: Keine
Dim myPwd As String, myPwd2 As String
Dim wks As Worksheet
myPwd = Application.InputBox("Passwort eingeben")
myPwd2 = Application.InputBox("Wiederholung")
If myPwd2 = myPwd Then
For Each wks In ActiveWorkbook.Worksheets
wks.Protect Password:=myPwd, DrawingObjects:=True, _
Contents:=True, Scenarios:=True, AllowFormattingCells:=True, _
AllowFormattingColumns:=True, AllowFormattingRows:=True
Next wks
Else
MsgBox "Passwort falsch"
End If
End Sub