Display username in a shared document

DRWesterhof

New Member
Joined
Jul 25, 2018
Messages
1
Hi,

I've been searching for a while now how to solve my problem, but I can't find a solution.

I have a shared document, altered by several people at the same time. When someone changes cell B2, I want their windowsusername displayed in cell C2. I already made the function =Username() in VBA. It works just fine with
=IF(B2="","",Username())
However, I want it to remain the usename of the person who changed B2. Now, when people are working in the document at the same time (and for example change B3), it changes to the user who saved it last.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hello, if you must use VBA code, I have provided it below. (This code should go in the code module for that specific sheet.)

However, it should be noted that, when using a shared workbook, you can enable the 'track changes' feature, which essentially does what you're asking for, straight out of the box.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Not Intersect(Target, Me.Range("B2")) Is Nothing Then
    Me.Range("C2").Value = Environ("UserName")
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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