View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] simmo13@gmail.com is offline
external usenet poster
 
Posts: 4
Default sheet protecting

On Apr 12, 2:10*pm, Mike H wrote:
Hi,

Try this

Private Sub Worksheet_Activate()
ActiveSheet.Protect Password:="mypass"
End Sub

Mike

"johnsail" wrote:
Hi
I have a routine that protects the worksheet when it is actioned.
Unfortunately I have been unable to include a password in this routine - so
the sheet is really unprotected and therefore open to alteration by the user.


The routine is:
'This is necessary to avoid having to unprotect
'and protect the sheet every time the macro fires
Private Sub Worksheet_Activate()
ActiveSheet.Protect UserInterfaceOnly:=True
End Sub


Any help appreciated.


I'd echo Mike H, but be sure to check the Excel VBA help and search
for the Worksheet.Protect method which lists all of the parameters.

Alex