View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
And1 And1 is offline
external usenet poster
 
Posts: 20
Default How to limit access to sheets ?? HELP ME

OK. but
in case of don't of authorization, active (and visible) will be the
sheet("Instructions")
And what will be if I change name from "Instructions" on different
(exemple "Andrew" - my name) and I record change???
Next time will not work.

I would like to if in case of don't of authorization don't active
(enabled) any sheets. The best to close workbook.

So I created "List" as you.
And created "Instructions", but for what it was needed
sheets("Instructions")

I wrote that code:

Private Sub Workbook_Open()
Dim wks As Worksheet
Dim ListWks As Worksheet
Dim InstWks As Worksheet
Dim res As Variant

Set InstWks = ThisWorkbook.Worksheets("Instructions")
Set ListWks = ThisWorkbook.Worksheets("List")

InstWks.Visible = xlSheetVisible
For Each wks In ThisWorkbook.Worksheets
If wks.Name < InstWks.Name Then
wks.Visible = xlSheetHidden
End If
Next wks

res = Application.Match(Application.UserName, ListWks.Range("a:a"),0)

If IsError(res) Then
MsgBox "You don't authorized for anything!"
' What HERE WRITE???????
Exit Sub
Else

ThisWorkbook.Worksheets _
(ListWks.Range("b:b").Cells(res, 1).Value).Visible =
xlSheetVisible
ThisWorkbook.Worksheets _
(ListWks.Range("b:b").Cells(res, 1).Value).Activate
End If
End Sub

Regards,
Andrzej


Dave Peterson napisał(a):
If macros are disabled, then this will not work!

But you could base your access on the user's name (Tools|Options|General tab).

I created a worksheet named List that had the usernames in column A and the
sheet that they can see in column B.

Then I put this in a general module:

Option Explicit
Sub auto_open()

Dim wks As Worksheet
Dim ListWks As Worksheet
Dim InstWks As Worksheet
Dim res As Variant

Set InstWks = ThisWorkbook.Worksheets("Instructions")
Set ListWks = ThisWorkbook.Worksheets("List")

InstWks.Visible = xlSheetVisible
For Each wks In ThisWorkbook.Worksheets
If wks.Name < InstWks.Name Then
wks.Visible = xlSheetHidden
End If
Next wks

res = Application.Match(Application.UserName, ListWks.Range("a:a"), 0)

If IsError(res) Then
MsgBox "not authorized for anything!"
Exit Sub
Else
ThisWorkbook.Worksheets _
(ListWks.Range("b:b").Cells(res, 1).Value).Visible = xlSheetVisible
End If
End Sub

All this fails with macros disabled and won't stop anyone from viewing any sheet
that they can.




And1 wrote:

I understand this.

but, where you know, that information in these sheets will be about
secret financial ?

I will get in there information about waste. Example: How many given
department used up paper...:)

I think to use propriety VISIBLE for Sheet.
I don't know only how to solve with password problem.
To write in code of programme...maybe in separate hidden sheet.

Now, someone help me ?
Regards,
Andrzej

Dave Peterson napisaÃ…€š(a):

If you change your question to:

I need some help making it so individuals can see their sheet easily, but it's
ok for everyone to see the other sheets if they know how and once they see it,
they can share that info with anyone they want, then you may get some more help.

But I'd be very careful putting finances in a workbook that I'm sharing with
people who shouldn't see it.

And1 wrote:


Well you are right, but i need something like this do
but,
If you can me help answer me.
If someone can me help, Please answer me.

Regards,
Andrzej

JE McGimpsey napisa³(a):


You'll need to find a different solution.

If it's important that individuals can only open "their" sheet(s), Excel
has nothing that will prevent someone savvy enough to find these
newsgroups from bypassing any internal protection. Especially since
you're presumably dealing with people with at least moderate technical
ability.