View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
SamuelT[_19_] SamuelT[_19_] is offline
external usenet poster
 
Posts: 1
Default Automatic Unprotect / Protect


Hi macropod,

Thanks for that. I've just tried to run the macro, but get a run-time
error 448. It doesn't seem to like the highlighted line:

Sub PF()
Dim Pwd As String
Pwd = "drowssap"
With Sheets("Programme (2 Week)")
..Unprotect Password:=Pwd
..AutoFilter Field:=9, Criteria1:="Peter Farrant"
..Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:=Pwd
End With
With Sheets("Programme (High Level)")
..Unprotect Password:=Pwd
..AutoFilter Field:=9, Criteria1:="Peter Farrant"
..Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:=Pwd
End With
With Sheets("Capacity")
..Unprotect Password:=Pwd
..AutoFilter Field:=5, Criteria1:="Peter Farrant"
..Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:=Pwd
End With
With Sheets("Components")
..Unprotect Password:=Pwd
..AutoFilter Field:=3, Criteria1:="Peter Farrant"
..Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:=Pwd
End With
With Sheets("Billing").Select
..Unprotect Password:=Pwd
..ScrollColumn = 1
..AutoFilter Field:=3, Criteria1:="Peter Farrant"
..Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:=Pwd
End With
With Sheets("Extra Fees Calculator").Select
..Unprotect Password:=Pwd
..AutoFilter Field:=3, Criteria1:="Peter Farrant"
..Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True, Password:=Pwd
End With
End Sub

Any suggestions?

TIA,

SamuelT


--
SamuelT
------------------------------------------------------------------------
SamuelT's Profile: http://www.excelforum.com/member.php...o&userid=27501
View this thread: http://www.excelforum.com/showthread...hreadid=548879