I have a wb with the five sheets named below plus a ws named "Control".
Change the references as needed to meet you needs. I run this in my
Workbook_Open event for a wb that does what you want:
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 = "Margaret"
Worksheets("Margaret").Visible = True
Worksheets("Margaret").Select
ActiveSheet.Range("A1").Select
Case Is = "Esther"
Worksheets("Esther").Visible = True
Worksheets("Esther").Select
ActiveSheet.Range("A1").Select
Case Is = "George"
Worksheets("George").Visible = True
Worksheets("George").Select
ActiveSheet.Range("A1").Select
Case Is = "Lloyd"
Worksheets("Lloyd").Visible = True
Worksheets("Lloyd").Select
ActiveSheet.Range("A1").Select
Case Is = "Jimmy"
Worksheets("Jimmy").Visible = True
Worksheets("Jimmy").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
--
Greeting from the Gulf Coast!
http://myweb.cableone.net/twodays
"Veera" wrote in message
...
The only way u can allow selective access to hide r unhide
a worksheet is to protect the workbook with a password. If
u set a password to protect the workbook, unless u
unprotect the workbook u cannot hide r unhide a worksheet.
So while opening the workbook the code will be
workbook.protect "password"
when the user wants to hide/unhide a sheet
workbook.unprotect "password"
worksheet.activate
worksheet.hidden=true/false
workbook.protect "password"
Veera
-----Original Message-----
I am looking for a way to hide a sheet for most of the
users. But some of the users should be able to see the
sheets. Therefore I am looking for a macro that unhides
the sheet with a password the selected users knows.
I am all out of ideas, and wondering if somebody knows a
way.
Thanks
Nicolay
.