passwording tabs

  • Thread starter Thread starter Lee_Woodcock
  • Start date Start date
L

Lee_Woodcock

i know you can password documents, protect cells, and worksheets.

But what i want to know is if you can password certain tabs in th
workbook ? So only users you access the workbook, and know th
password can assess certain tabs within the book (and thus view th
data)
 
Hi Lee!

You can apply different passwords to different sheets.

Select the sheet
Tools > Protection > Protect Sheet
Give and confirm password for that sheet
OK
Select the next sheet

However, don't use this process for protecting sensitive data because
these passwords are very easily circumvented:

See:
JE McGimpsey
http://www.mcgimpsey.com/excel/removepwords.html
 
thank you for that,

but

its not quite what imeant :)

ok, a standard excel workbook has 3 sheets - defaulting to sheet1 whe
you open it.

what i want is a password on say sheet3 - so as soon as you click o
sheet 3 your asked for a password. confirmation of this password wil
then display sheet 3, else you wont be able to see the contents.
 
Hi Lee!

Use a Workbook_SheetChange event handling subroutine for this.
 
Hello Lee
Since you still want worksheet tabs to be visible, here's a suggestion:
1- hide rows and columns in the relevant sheet
2- protect sheet
3- place the sample code below into thisWorkbook (amend accordingly)
Tip: right-click on the Excel Icon situated immediately on the left from the
File menu of Excel, choose View code and paste the code
4- please bear in mind that this will only work for macros enabled ;-)
Cordially
Pascal

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim GiveSesame$
Select Case Sh.Name
Case Is = "Feuil2"
If Worksheets(Sh.Name).Rows.Hidden <> False Then
GiveSesame = InputBox("Password please ?", "Protected sheet")
If GiveSesame = "password" Then
With Worksheets(Sh.Name)
.Unprotect (GiveSesame)
.Rows.Hidden = False
.Columns.Hidden = False
End With
Else: MsgBox "Cancelled or Wrong password", vbCritical, "Sorry"
End If
End If
End Select
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Select Case Sh.Name
Case Is = "Feuil2"
With Worksheets(Sh.Name)
If .Rows.Hidden = False Then
.Rows.Hidden = True
.Columns.Hidden = True
.Protect ("password")
End If
End With
End Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top