Auto Updating the Logged in User

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a some excel sheets located on a network server and would like to
make it so one of the fields lists the logged in user as soon as the sheet is
open. I found this VBA Macro in one of the past posts:

Function UserName()
UserName = Environ("UserName")
End Function

This function displays the user but does not auto update when I open the
sheet. I have to double click on the name for it to update the user.
 
Give this a try...

Function UserName()
Application.Volatile
UserName = Environ("UserName")
End Function

Note that this function is volatile so it will update every time any
calculation is run which gives it a bit of overhead... Probably not a big
deal in this case.
 
Back
Top