Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Protected Sheets

Status
Not open for further replies.

ninja1980

Technical User
Sep 5, 2008
20
GB
Hi

I’ve added to following code to a project I’m working on to allow VBA to update locked cells.

****************************************

Private Sub Workbook_activate()

Dim wSheet As Worksheet

For Each wSheet In Worksheets

wSheet.Protect UserInterFaceOnly:=True '====>Allow all protected sheets to be updated by VBA

Next wSheet

End Sub

*******************************************

I’ve since added a password to protect the sheet and the above routine is failing. Can anyone tell me how I add the password to the VBA code???

Thanks
 
You need to repeat password:
wSheet.Protect Password:="Pass", UserInterFaceOnly:=True

combo
 




"Can anyone tell me how I add the password to the VBA code???"

Did you ever try your macro recorder?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top