Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Hide/lock worksheets

I have a workbook with 10 spreadsheets. Each sheet/tab is for individual
employees. Is there a way to have a user sign in and only view their own tab
and not gain access or even hide the other employees sheets/tabs?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,071
Default Hide/lock worksheets

You can have a sign-in sheet that would display when the file is opened.
You could then have a drop-down in a cell that would display all the names.
The user would select a name (his own, presumably) and his sheet would be
displayed. But what is there to prevent him from selecting another name
than his own? Well, Excel could ask for a password. All of this would be
based on the sheets being VeryHidden, a concept that would require the user
to have some knowledge of VBA programming to defeat. But be aware that
Excel is not built to be a secure platform. To the casual user yes. To the
knowledgeable user, no. Come back if you want to pursue this further. HTH
Otto

"McChas" wrote in message
...
I have a workbook with 10 spreadsheets. Each sheet/tab is for individual
employees. Is there a way to have a user sign in and only view their own
tab
and not gain access or even hide the other employees sheets/tabs?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,276
Default Hide/lock worksheets

Hi,
Let's say sheet 1 can be access by user 1 so right click on the sheet1 tab,
view code and there copy below code. Password is "MANAGER" you can copy the
same code in all the other sheets and just change the password. Then hide the
sheet and make a menu access like user name so when the user click on the
button it will be asked for the password if the password is wrong will be
returned to the main menu

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


When creating the Menu to access the file you can assign the macro as follow
to the button

Sub Sheet1()
'
' Sheet1 Macro
'
Sheets("Menu").Select
Sheets("Sheet1").Visible = True
Sheets("Sheet1").Select

"McChas" wrote:

I have a workbook with 10 spreadsheets. Each sheet/tab is for individual
employees. Is there a way to have a user sign in and only view their own tab
and not gain access or even hide the other employees sheets/tabs?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Hide/lock worksheets

Not too easily. A really dedicated user can crack Excel's security.

Requires VBA code and some passwords or login names.

Sample code.......................

Note: the following is contingent upon users enabling macros.

If they don't only the "Dummy" sheet will be visible with a large message
stating "By disabling macros you have rendered this workbook unusuable.
Please close and re-open with macros enabled"

I assume you are on a network(LAN) with users logging into the system.

I would set it up so that whichever user's login name is flagged, all sheets
except that user would be hidden.

No password to open the workbook or sheet protection, just code to make a
user's sheet visible.

In the Thisworkbook Module....................

Private Sub Workbook_Open()
Dim pword As String
On Error GoTo endit
Select Case Environ("Username")

'if a login is not used change to
'pword = InputBox("Enter Your Password")
'Select Case pword

Case Is = "Gord": Sheets("Gordsheet").Visible = True
Case Is = "Pete": Sheets("Petesheet").Visible = True
End Select
Sheets("Dummy").Visible = False
Exit Sub
endit:
'MsgBox "Incorrect Password"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht As Worksheet
Application.ScreenUpdating = False
Sheets("Dummy").Visible = xlSheetVisible
For Each sht In ActiveWorkbook.Sheets
If sht.Name < "Dummy" Then
sht.Visible = xlSheetVeryHidden
End If
Next sht
Application.ScreenUpdating = True
ThisWorkbook.Save
End Sub

To allow you to see all sheets and edit them.

In a general module...............

Sub UnHideAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Visible = True
Next n
Application.ScreenUpdating = True
End Sub

Naturally you want all this code invisible to the users.

Right-click on the workbook/project in VBE and select VBAProject Properties
and "Lock project for viewing"

Enter a password.


Gord Dibben MS Excel MVP

On Thu, 7 Jan 2010 09:17:02 -0800, McChas
wrote:

I have a workbook with 10 spreadsheets. Each sheet/tab is for individual
employees. Is there a way to have a user sign in and only view their own tab
and not gain access or even hide the other employees sheets/tabs?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Hide/lock worksheets

How much security do you need? Excel does possess adequate security features
to stand-up to a medium-large security attack.

Some basic ideas that are possible:
a) have a macro copy one sheet from master workbook into a new workbook.
b) In VBE, set visible property of other user sheets to "xlSheetVeryHidden"

But again, these are very weak security. The safest bet would be to split up
the workbook (See Ron's site for help on this:
http://www.rondebruin.nl/copy6.htm) and then place them each into folders
that only each user can access.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"McChas" wrote:

I have a workbook with 10 spreadsheets. Each sheet/tab is for individual
employees. Is there a way to have a user sign in and only view their own tab
and not gain access or even hide the other employees sheets/tabs?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I lock the first tab of multiple worksheets cailasgramma Excel Worksheet Functions 1 September 16th 08 04:52 PM
Can I lock a worksheet and still be able to hide and show groups? Ryan Excel Discussion (Misc queries) 2 September 6th 08 12:13 AM
Hide and lock cell formulas without affecting Macro? Mike Excel Discussion (Misc queries) 4 May 23rd 08 11:53 PM
Lock Columns and Hide Formula's sparky3883 Excel Worksheet Functions 1 October 14th 05 09:11 PM
hide a column and lock it out Becky Excel Discussion (Misc queries) 2 May 27th 05 05:31 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"