protecting sheets from a macro

  • Thread starter Thread starter MattB
  • Start date Start date
M

MattB

I am running a macro from an option button in a sheet
named "Summary". The macro make s various formatting
changes, but it needs to unprotect the sheet first. I am
running the following code, but the I get a run time error
when it executes. Can any one help?

Password = "Testpassword"
Worksheets("Summary").Select
Worksheets("Summary").Unprotect Password:=Password
 
Here is a copy of a macro that I wrote...See if this helps
Sub unprotect_workbook_cc()
Dim password
password = InputBox("Please Enter Your Password!")
If password = "3579" Then
ActiveWorkbook.Unprotect password:="3579"
Sheets("chris").Visible = True
Else
MsgBox "Incorrect Password, Please Enter Again.",
vbExclamation
End If
End Sub
 
Back
Top