[INDENT]Hello All,
I have a spreadsheet that I would like to write code so depending on your USER ID (windows login) will show certain sheet. I know how to get the user id using Environ("username")
so for eg USER 1 - Access to all sheets
USER 2 - Access to sheet 2 only
USER 3 - Access to sheet 3 only.
I have searched various forums / sites but to no avail. I am not even a novice in VBA so if possible treat any answers like your speaking to a 5 year old.
This is as close as I have came but no results or errors.
Private Sub User_Name()
[INDENT]
Code
Private Sub userid()
If Environ("UserName") = "USER2" Then
Worksheets("Sheet1").Visible = xlSheetVeryHidden
Worksheets("Sheet2").Visible = True
Worksheets("Sheet3").Visible = xlSheetVeryHidden
Else
If ("UserName") = "USER2" Then
Worksheets("Sheet1").Visible = xlSheetVeryHidden
Worksheets("Sheet2").Visible = xlSheetVeryHidden
Worksheets("Sheet3").Visible = xlSheetVeryHidden
End If
End If
End Sub
Display More
[/INDENT]
Any help pointing me in the right direction would be greatly appreciated.
ps I know this is not 100% secure but will only be used for a small group of people with non-confidential data [/INDENT]