afternoon all!
I think i've posted something similar here before but i can't find it through the 'My Posts' option, so please forgive me for asking.
I have the following:
Private Sub Workbook_Open()
Application.ScreenUpdating = False
Range("A2").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.NumberFormat = "[$-F400]h:mm:ss AM/PM"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.NumberFormat = "m/d/yyyy"
Range("C2").Value = Environ("Username")
Application.ScreenUpdating = True
End Sub
How can i (if i even can) get my VBA to check the usernam that is trying to open the spreadsheet, and if it is one of 3 (for example) then the spreadsheet will open.
If the username does not match one of the threee names, i dont want the sheet to open.
Don't mind at present if the names are defined either in the code itself or the code reads from a list on one of the tabs.
I know i can put a password in to prevent the sheet being opened, but at present i dont want to follow that route, so thought i would ask if the above is possible.
Many thanks in advance.
Rich
Bookmarks