How do you reference the logged on user name in excel?

T

Taurus

I am making a template that sever users will be using this & I don't know how
to automatically put the logged in users name into the header. Can someone
help with this???
 
L

Leith Ross

Hello Taurus

The name of the current user can be returned usin
Application.UserName. There are 3 headers on each Worksheet, Left
Center, and Right. These are accessed through PageSetup

Example for Left Header
Worksheets("Sheet1").PageSetup.LeftHeader = Application.UserNam

Example for Center Header
Worksheets("Sheet1").PageSetup.CenterHeader = Application.UserNam

Example for Right Header
Worksheets("Sheet1").PageSetup.RightHeader = Application.UserNam

Remember this has to be done to each sheet you want a header to appea
on. Replace "Sheet1" in the examples with the name of Worksheet tha
will have a header

Sincerely
Leith Ros
 
T

Taurus

Leith,

Is this using the VBA part of excel? I am pretty much a newbie in that. I
have written any type of VB code in a while... I will try to keep at it but
s far I am unsuccsessful.

Sincerely, Taurus.
 
Top