ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   In Excel, how do I insert User Name (author) in a cell. (https://www.excelbanter.com/excel-discussion-misc-queries/41882-excel-how-do-i-insert-user-name-author-cell.html)

George B.

In Excel, how do I insert User Name (author) in a cell.
 
The function =CELL("filename",A1) returns a file name and sheet name in a
cell. How can I obtain the User Name?

Excel_Geek


You can write some VBA to do it.

Sub Return_UserName()

Sheets("sheet1").Range("A2").Value = Application.UserName

End Sub


--
Excel_Geek


------------------------------------------------------------------------
Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
View this thread: http://www.excelforum.com/showthread...hreadid=398347


Excel_Geek


And to return just the filename (if you like) you can use this formula:

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)


--
Excel_Geek


------------------------------------------------------------------------
Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
View this thread: http://www.excelforum.com/showthread...hreadid=398347


George B.

Very nice. This is going into my Macro Toolkit.

"Excel_Geek" wrote:


You can write some VBA to do it.

Sub Return_UserName()

Sheets("sheet1").Range("A2").Value = Application.UserName

End Sub


--
Excel_Geek


------------------------------------------------------------------------
Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
View this thread: http://www.excelforum.com/showthread...hreadid=398347




All times are GMT +1. The time now is 05:08 PM.

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