Excel Identify users audit

Nothnless

Board Regular
Joined
Apr 28, 2016
Messages
142
Hi, I'm trying to keep track of who opens an excel workbook and the date.

I have some code here to identify the user:

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

This is a good start but a single cell is not a good solution because I would always just see me as the last person who opened it. Is there a way to use the formula so that it will display the user in the next cell? for example, if John opens it on 01/01/19 and then Mary opens it on 01/02/19, then when I open it on 01/03/19 I should see A1 = John, B2 = 01/01/19, A2 = Mary, B2 = 01/02/19, and A3 = Me, 01/03/19. Then after about 100 rows, it deletes the audit trial and starts over at A1 so it doesn't get to big.

You could call it an Audit Trail worksheet, I think it would be a great addition to the forum.

Thank you,
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
(In VBA, double click on ThisWorkbook in VBA Project window) Place this code in the ThisWorkbook module
Code:
Private Sub Workbook_Open()
    Sheets("[COLOR=#ff0000][I]NameLog[/I][/COLOR]").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(, 2) = Array(Environ$("UserName"), Date)
End Sub

Amend sheet name
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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