Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Sheet protection with password | Column protection with password

  Asked By: Clark    Date: Jan 04    Category: MS Office    Views: 931
  

I have some standard data in a particular sheet and I dont' want to change it.
So I have protected with password manually. When the user want to change or add
any more details on the sheet, I want to unprotect the sheet by using
password. I was unable to protect or unprotect the sheet with password on
coding (But i can do it manually). Could you please help me on the same.

Moreover, In the working sheet, I have some calculation which I dont' want to
show it to the user and I don;t want the user to edit the data. How do we
protect or unprotect the particular column in a sheet with password.

Please advice me on the above two points.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Roosevelt Jenkins     Answered On: Jan 04

I'll address the second question first.
On the sheet  change all of the cells to "unlocked".
Then select the cells you want to protect, and change
the property to "locked".
Now, when you protect  the sheet, be sure to remove the authorization
that says to allow users to select locked cells.
Now, record a macro in which you change  the protection  on the sheet.
The macro record function will not include the password.
What you have to do is something like:
MyPasswd = "testing"

Sheets("Sheet1").Protect _
DrawingObjects:=False, _
Contents:=True, _
Scenarios:=True, _
AllowFormattingCells:=True, _
Password:=MyPasswd
To unprotect, use:
Sheets("Sheet1").Unprotect Password:=MyPasswd
Of course you should password  protect your VBA modules to keep
users from being able to find your hard-coded password!

 




Tagged: