VBA help - Showing Username of Person Updating Spreadsheet

Necroscope

Board Regular
Joined
Jul 7, 2004
Messages
72
Hi.

I have a Userform that some users complete to update info on a (large) table. I've added a bit of VBA to get the date added when the user who has opened the spreadsheet makes a change to the database but I'd like to be able to add their name too.

However, when I use Application.Username I get the full Global Address List name of that user (i.e. Smith John Sales Team Manager). When I use Environ("username") I get the user's 8-digit staff number.

What I'd like to display is "John Smith"... Anyone know if this is possible?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
perhaps something like this
Code:
Sub testing()
    Dim excelUserName As String, usr
    
excelUserName = Application.UserName

If InStr(excelUserName, " ") Then
    usr = Split(excelUserName, " ")
    MsgBox usr(1) & " " & usr(0)
Else
    MsgBox excelUserName
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,754
Messages
6,180,749
Members
452,996
Latest member
nelsonsix66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top