Password Protect Viewing of Individual Worksheets?

BKelleher

New Member
Joined
Oct 7, 2009
Messages
13
PLEASE HELP.

I have a file w/ individuals monthly sales information (per worksheet) that needs to be distributed in one mass email to the entire sales force. I want everyone to have access to the "Summary" tab, but individuals should only have access to their own "Details" tab. I know there has to be a way to accomplish via VBA. However, I'm not proficient in writing code. I'd really appreciate any guidance/suggestions.

Thanks!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
The fact you are in 2007 should not matter. Here is the corrected code
Rich (BB code):
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim ws As Worksheet
For Each ws In Sheets
If ws.Name <> "Summary" Then ws.Visible = xlSheetVeryHidden
Next ws
End Sub
Private Sub Workbook_Open()
Dim user As String
Dim pwd As String
Dim ct As Integer
Dim C As Range
Dim LR As Long
LR = Sheets("LogIn").Cells(Rows.Count, "A").End(xlUp).Row
user = InputBox("Enter your UserName")
Set C = Worksheets("LogIn").Range("$A1:$A" & LR).Find(user, LookIn:=xlValues)
    If C Is Nothing Then
        MsgBox "Unauthorized to proceed"
        Me.Close
    End If
ct = 2
retry:
    pwd = InputBox("Enter Password")
    If pwd <> Sheets("LogIn").Cells(C.Row, 2) Then
    If ct = 0 Then
       MsgBox "Out of tries"
       Me.Close
   End If
       MsgBox "Wrong Password." & Chr(10) & "You have " & ct & " tries left"
       ct = ct - 1
       GoTo retry
   End If
Dim ws As Worksheet
For Each ws In Sheets
If ws.Name = Sheets("LogIn").Cells(C.Row, "C") Then ws.Visible = xlSheetVisible
Next ws
End Sub
Sorry, I also missed the LR

lenze
 
Upvote 0
Hi Bc:
Yes, I'm sure it can be adjusted to accomodate that. I suggest you start a new thread and refer back to this one for code adjustment. Others are more likely to look a a post with only a few responses than one with 14+. I will look for it tomorrow or Monday.

lenze
 
Upvote 0
The whole post is exactly what I have been looking for, but I have absolutely no clue about codes. You mentioned about the need of formulating a macro. So, do you mind showing me how to write that macro? Many many thanks.
 
Upvote 0
I publish an expense report monthly which is privy only to the spenders. I have a macro set up such that I select a name from a dropdown...the sheet calculates the expenses for the individual I selected, it then extracts and emails to that person.

Cookie crumbs. lol
 
Upvote 0
Thanks - this works great! I am already seeing tons of potential for this tool. Quick question, is there a way to make it so one login/pw combination works for multiple hidden sheets? for example - if the user needs to see 3 different departments.

Thanks so much.
 
Upvote 0
Thanks - this works great! I am already seeing tons of potential for this tool. Quick question, is there a way to make it so one login/pw combination works for multiple hidden sheets? for example - if the user needs to see 3 different departments.

Thanks so much.
Ive done that before, but I can't exactly remember what I did. I can think of two approaches. One would be to duplicate the Name in Column "A" and PAassword in Column "B" of youir sheet for each Sheet to be visible and then use FINDNEXT (See VBA help files)
HTH
lenze
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top