View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Eduardo Eduardo is offline
external usenet poster
 
Posts: 2,276
Default Office 2007 - protecting workbook

hI,
This is the code used to copy it do right click in the tab name, view code
and copy it, change the password to yours, if you want to have different
sheets to be unhided with different password you will have to change the
password in each sheet

Private Sub Worksheet_Activate()
Dim strPassword As String
On Error Resume Next
Me.Protect Password:="MANAGER"
Me.Columns.Hidden = True

strPassword = InputBox("Enter password to access DATA sheet")

If strPassword = "" Then
ActiveSheet.Visible = False
Worksheets("Menu").Select
Exit Sub
ElseIf strPassword < "MANAGER" Then
MsgBox "Password Incorrect "
ActiveSheet.Visible = False
Worksheets("Menu").Select
Exit Sub
Else
Me.Unprotect Password:="MANAGER"
Me.Columns.Hidden = False
End If
Range("a1").Select

On Error GoTo 0
End Sub

Private Sub Worksheet_Deactivate()
On Error Resume Next
Me.Columns.Hidden = True
On Error GoTo 0
End Sub

to unhide the sheet just create a buttom with a macro asking to unhide sheet
???

if this helps please click yes, thanks

"Eduardo" wrote:

Hi,
What I did in a similar case is to hide the workbook that I don't want
anybody to look at and then protect the sheet, then I give the password to
the users I want to see the information. To unprotect the sheet I prepare a
macro asking for the password, however when hidding the sheet be sure that
you go far from where the information is let's say AZ1000, the reason is
because when asking for the password the sheet shows up first if the password
is incorrect it will hide again, hiding it in AZ1000 makes the user first
thing to see is that cell

if this helps please click yes

"JWhitehead" wrote:

I have a user who is running office 2007, and is trying to protect a workbook
in Excel. I know how to do this part. The question is though, is it possible
to pwd protect the viewing of only one worksheet.

Example: there are 2 pages in the workbook. Page 1 has data that everyone
can view. Page 2 has data that only some can view. Other than pwd protecting
the contents of page 2 and changing the font colour to white, is there a way
to do this?

Thank you all for your help.