Can a macro protect a sheet and set a password?

  • Thread starter Thread starter wesandem
  • Start date Start date
W

wesandem

I am trying to write a macro that protects a sheet and protects it wit
a password. I simply recorded that action and it did not include th
password (see below). Is there a way? Please help! Thanks!

Sub Protect()'
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True
End Su
 
Just include the password parameter. E.g.,

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:="whatever"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top