Can a macro protect a sheet and set a password?

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
 
C

Chip Pearson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top