View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
somethinglikeant somethinglikeant is offline
external usenet poster
 
Posts: 94
Default Protecting Sheet

Hi Nad,

You could probably do this without using macros, but here is a nice
little solution hopefully:-

First Protect the sheet by going to Tools Protection Protect Sheet
set the password as the one you stated in your code EPM
Click OK

Then write this code into the Activate Worksheet module for this
sheet:-

:=======================

Private Sub Worksheet_Activate()

If ActiveSheet.ProtectContents = True Then
psw = InputBox("Please insert password to view data.", "Password
Checker")
If psw = "EPM" Then
Sheets("ABD").Unprotect ("EPM")
Else
MsgBox "Incorrect Password"
End If
End If

End Sub

:========================

Should work OK, let me know if there aare any problems

somethinglikeant
http://www.excel-ant.co.uk