View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default View limited sheets in workbook based on logon/password protect

Nicole,
Here is some code to only give you an idea, it is far from complete
Also, there are other ways of doing this.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

'The workbook must be protected to prevent worksheets
'from being moved.
'All sheets should be hidden (xlVeryHidden) when the
'workbook is opened/closed - except for the start sheet
'where the user enters the password.
'-------------------------------
Private Function VisibleLies(ByRef strPassword As String)
Dim x As Long
'Establish passwords and the beginning worksheet index number.
'Assumes worksheets to display are contiguous.

Select Case strPassword
Case "abcd"
x = 2
Case "bcde"
x = 5
Case "cdef"
x = 8

'More of the same

Case "zzzz"
x = 99
End Select

If x 0 Then
Worksheets(x).Visible = True
Worksheets(x + 1).Visible = True
Worksheets(x + 2).Visible = True
Else
MsgBox "Password incorrect", vbExclamation, "Secret Stuff"
End If
End Function

'Call the function and supply password.
Sub StartItUp()
Call VisibleLies("bcde")
End Sub
'------------------------------------


"Nicole Seibert"
wrote in message
Can I create a workbook that limits the sheets that are shown after logon?
I am setting up macros to create hundreds of sheets in groups of threes.
This will eventually all my automated. But, each manager needs to only view
their data for legal reasons. There are other ways of getting this
information within the company, but the legal team would like for me to limit
access when I can.

I have never tried to password protect a document for around a hundred users
and their corresponding passwords and then only show them their three sheets
of data.

Any suggestions on where to start?