Sunday, May 13, 2007

Protecting / Unprotecting a sheet


The macros below will protect/unprotect the current worksheet with a password.

Sub ProtectSheet()
Dim Password 'This line of code is optional
Password = "1234"
ActiveSheet.Protect Password, True, True, True
End Sub
Sub UnProtectSheet()
Password = "1234"
ActiveSheet.Unprotect Password
End Sub

No comments:

Post a Comment