This'll protect all the unprotected worksheets with the same password:
Option Explicit
Sub testme01()
Dim myPwd As String
Dim wks As Worksheet
myPwd = InputBox(prompt:="what's the password, kenny?")
If Trim(myPwd) = "" Then
Exit Sub
End If
For Each wks In ThisWorkbook.Worksheets
If wks.ProtectContents _
Or wks.ProtectDrawingObjects _
Or wks.ProtectScenarios Then
'already protected
Else
wks.Protect Password:=myPwd
End If
Next wks
End Sub
Iain wrote:
Is there a way to prompt for a password that covers all sheets when using VBA
to protect multiple sheets in a workbook?
--
Dave Peterson