View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Macro to Unprotect Sheet

Hi
try

Public Sub Button11_Click()
On Error Resume Next
with Worksheets(Range("E5").value)
.unprotect password:=worksheets("home").range("E7").value
.activate
end with
On Error GoTo 0
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


wrote:
I was afraid I wasn't going to explain this clearly.

I have a sheet called Home. On this sheet, a user enters
their user name and password. There is a corresponding
sheet with that users name. I have a button that the user
will push after entering their username and password that
directs them to their password protected sheet. This gets
me to that sheet but does not unprotect the sheet.

Public Sub Button11_Click()
On Error Resume Next
Worksheets(Range("E5").Text).Activate
On Error GoTo 0
End Sub


I wanted to continue with the code so that the password
entered by the user in cell 'Home'!E7 will unprotect the
corresponding sheet so the user can make edits.

Thanks

-----Original Message-----
Hi
maybe something like

sub foo()
on error resume next
with activesheet
.unprotect password:= .range("A1").value
end with
on error goto 0
end sub


--
Regards
Frank Kabel
Frankfurt, Germany


Eric wrote:
Do any of you happen to know of any code that will
unprotect an Excel sheet when run?

The password will be input by the user in a designated
cell.

Thanks

.