Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Password / Filter workbook by user

I have a workbook that contains information that I would like to use as a
shareable workbook for 4 other people but I don't want each user to see the
information that relates to the other users. I don't want to separate the
workbook and consolidate every time that users make changes. Is it possible
to open the workbook with a password (by user) and have the user only see the
information that shows the information for that specific user? The user's
name appears in one of the columns.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Password / Filter workbook by user

Can be done with the caveat that Excel internal protection is quite weak and
it is very difficult to keep a determined user from gaining access to data
on hidden sheets.

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 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
'add more Cases for other users
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 Wed, 17 Mar 2010 13:53:02 -0700, SDamico
wrote:

I have a workbook that contains information that I would like to use as a
shareable workbook for 4 other people but I don't want each user to see the
information that relates to the other users. I don't want to separate the
workbook and consolidate every time that users make changes. Is it possible
to open the workbook with a password (by user) and have the user only see the
information that shows the information for that specific user? The user's
name appears in one of the columns.
Thanks


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
Password protection excel document - last user setting lost Jon's problem Excel Discussion (Misc queries) 0 October 23rd 07 11:52 PM
Protection password iin VBA, how to avoid user seeing it? Afsha Excel Discussion (Misc queries) 2 January 23rd 07 03:06 PM
Password-Protected Workbook not showing "in use by another user" Jim Jackson Excel Discussion (Misc queries) 1 July 13th 06 03:11 PM
Multiple workbook user's with Master workbook - all password protected Yvon Excel Discussion (Misc queries) 2 March 30th 05 01:34 PM
Hiding columns based on user/password jmatchus Excel Worksheet Functions 0 January 17th 05 06:49 PM


All times are GMT +1. The time now is 07:24 PM.

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

About Us

"It's about Microsoft Excel"