View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kashyap Kashyap is offline
external usenet poster
 
Posts: 131
Default unprotect when file is shared

Hi, I have the below code but when I share workbook it does't work.. any help
pls

Sub UnP()
Dim wks As Worksheet
Dim strPassword

strPassword = InputBox("Enter the password", "Password")

ActiveSheet.Unprotect Password:=strPassword
Range("A4:I1000").Select
Selection.Locked = False
ActiveSheet.Protect contents:=False
ActiveSheet.Protect Password:=ActiveSheet.Range("P1").Value
Application.Goto Reference:="R4C1"
Selection.End(xlDown).Select

On Error GoTo 0

End Sub