Worksheet Security

A

Ariyanto Dewo

Hi all,
I have a users who create an excell file with many
worksheets. Now he wants to assign a security on each
worksheet. certain users are permitted to certain
worksheets only, and so on. Is possible to create such
permission? If so, how do I do this?
Any helps are very very appreciate. Thank you
 
J

Jim

I have this in a workbook where I want certain users to see only theit
worksheet:

Private Sub Workbook_Open()
'MsgBox "This worksbook has 6 worksheets: one named Control which is always
visible, and sheets named Name1, Name2, Name3, Name4, and Name5. If you
type one of those names you will see a worksheet with the corresponding name
on the tab. If you do not enter one of the names an error will be
generated."

Call HideSales
Call GetValidInput
End Sub

Sub HideSibs()
Worksheets("Name1").Visible = False
Worksheets("Name2").Visible = False
Worksheets("Name3").Visible = False
Worksheets("Name4").Visible = False
Worksheets("Name5").Visible = False
End Sub

Function GetValidInput() As String
Dim i As String
i = InputBox("Please enter your name, capitalizing the first letter:")
Select Case i
Case Is = ""
msgBox "You have not entered a valid name. You will have to press OK to
let this file close and try again."
ThisWorkbook.Save
ThisWorkbook.Close
Case Is = "Name1"
Worksheets("Name1").Visible = True
Worksheets("Name1").Select
ActiveSheet.Range("A1").Select
Case Is = "Name2"
Worksheets("Name2").Visible = True
Worksheets("Name2").Select
ActiveSheet.Range("A1").Select
Case Is = "Name3"
Worksheets("Name3").Visible = True
Worksheets("Name3").Select
ActiveSheet.Range("A1").Select
Case Is = "Name4"
Worksheets("Name4").Visible = True
Worksheets("Name4").Select
ActiveSheet.Range("A1").Select
Case Is = "Name5"
Worksheets("Name5").Visible = True
Worksheets("Name5").Select
ActiveSheet.Range("A1").Select
Case Else
msgBox "You have not entered a valid name. You will have to press OK to
let this file close and try again."
ThisWorkbook.Save
ThisWorkbook.Close
End Select
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top