Protect All Worksheets

Sub ProtectAllWorkSheets()
 Dim ws As Worksheet
 Dim myPassword As String

 If ActiveWorkbook Is Nothing Then Exit Sub

 myPassword = InputBox("Please enter your password" & vbCrLf & _
 "(Leave blank for no password)" & vbCrLf & vbCrLf & _
 "Make sure you don't forget your password!", "Enter Password")
 
For Each ws In ThisWorkbook.Worksheets
  ws.Protect (myPassword)
 Next ws

End Sub


© Copyright andrewsexceltips.net All Rights Reserved.