How to show current user name in a cell?

前端 未结 6 653
太阳男子
太阳男子 2021-02-02 11:26

In most of the online resource I can find usually show me how to retrieve this information in VBA. Is there any direct way to get this information in a cell?

For example

6条回答
  •  清酒与你
    2021-02-02 12:01

    Based on the instructions at the link below, do the following.

    In VBA insert a new module and paste in this code:

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

    Call the function using the formula:

    =Username()
    

    Based on instructions at:

    https://support.office.com/en-us/article/Create-Custom-Functions-in-Excel-2007-2f06c10b-3622-40d6-a1b2-b6748ae8231f

提交回复
热议问题