View Single Post
  #7   Report Post  
Old July 29th 08, 06:24 PM posted to microsoft.public.excel.worksheet.functions
ryguy7272 ryguy7272 is offline
external usenet poster
First recorded activity by ExcelBanter: Dec 2006
Posts: 2,836
Default Different password for different worksheet

This is how I do it...

Place the following code in a Sheet (not a module)
Basically, right-click the sheet and click ‘View Code’
Private Sub CommandButton1_Click()

Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If

Select Case (i_pwd)
Case Is = "showmktg"
Worksheets("mktg1").Visible = True
Worksheets("mktg2").Visible = True
Worksheets("mktg2").Visible = True


Case Is = "showsales"
Worksheets("sales1").Visible = True
Worksheets("sales2").Visible = True
Worksheets("sales3").Visible = True

Case Is = "showall"
Call ShowSheets

Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

End Sub

Sub ShowSheets()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
If (sh.Name) < "Password" Then
If sh.Visible = xlSheetVeryHidden Then
sh.Visible = True
End If
End If
Next sh

End Sub

Place following code in sheet called ‘ThisWorkbook’
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call HideSheets
End Sub



"Freshman" wrote:

Thanks Stefi.

"Stefi" wrote:

Set ToolsProtectionSheet protection individually for each sheets with
different passwords!


„Freshman” ezt *rta:

Dear expert,

I want to create a workbook with different worksheets for different users.
For security purpose, I want different worksheet has a different password to
protect so that the only authorized user can edit the content on his/her
designated worksheet.
For example, sheet "marketing" has a password "1234" and sheet "sales" has a
password "1235" to protect. Is it possible? Please kindly advise.

Thanks in advance.