ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I display a user name is Excel? (https://www.excelbanter.com/excel-discussion-misc-queries/227534-re-how-can-i-display-user-name-excel.html)

Gary''s Student

How can I display a user name is Excel?
 
Try this User Defined Function:

Function username() As String
username = Environ("username")
End Function


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx

--
Gary''s Student - gsnu200846


"Phil_M" wrote:

Rather than having everyone enter their name in a spreadsheet before printing
their reports I was wondering if there is a function that would display the
user's user or display name in a cell.

Thanks,
Phil



All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com