View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Macksey Ken Macksey is offline
external usenet poster
 
Posts: 77
Default Unprotect question.

Hi

Instead of this,

Sub unpro_pro()
Range("B2").Select
Worksheets("sheet1").Unprotect Password:="YourPassword"
ActiveCell.FormulaR1C1 = "=R[1]C[4]"
Range("B2").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Worksheets("sheet1").Protect Password:="YourPassword"
End Sub


Try it like this

Sub unpro_pro()
Range("B2").Select
Worksheets("sheet1").Unprotect Password:="YourPassword"
ActiveCell.FormulaR1C1 = "=R[1]C[4]"
Range("B2").Select
Worksheets("sheet1").Protect Password:="YourPassword",
DrawingObjects:=True, Contents:=True, Scenarios:=True

End Sub

I didn't check the Protect syntax for the order of the items following
protect, but it seemed to work for me.

HTH

Ken