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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,213,532
Messages
6,114,177
Members
448,554
Latest member
Gleisner2

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