Password in a macro

  • Thread starter Thread starter T
  • Start date Start date
T

T

This is what I am trying to accomplish, however I get an
error when the macro hits password. I want my macro to
lock all the worksheets in an excel file when I run it.

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True, Password:=xxxx, Password:=xxxx
 
Hi T!

Try:

For j = 1 To Worksheets.Count
Worksheets(j).Protect Password:="not4u2see"
Next j
ActiveWorkbook.Protect Structure:=True, Windows:=False,
Password:="not4u2see"


--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
Back
Top