Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

How to PASSWORD protect a worksheet

  Asked By: Kelley    Date: Jan 27    Category: MS Office    Views: 811
  

Here is my code...

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowSorting:=True,
AllowFiltering:=True

How would I adjust this so that it is password-protected.

If I use:
ActiveSheet.Protect "password"
,it works,
But the default settings from password protection don't let me use
the spreadsheet as I intended.

I'm just learning VBA and hoping someone more experienced can help
me?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Alisha Johnson     Answered On: Jan 27

You just add

Password:= "Password"

In the following I have split the code  into separate lines so it won't get
messed up by the email program and is easier to read. To split a line you
insert a space, and underline and a return character(enter)


ActiveSheet.Protect _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True _
Password:= "Password"

 
Answer #2    Answered By: Varick Fischer     Answered On: Jan 27

Thank you- just what I needed!!!!!!!!!!!!!!!!!!

 
Didn't find what you were looking for? Find more on How to PASSWORD protect a worksheet Or get search suggestion and latest updates.




Tagged: