Adding "Last edited by" to header in excel

Copper Contributor

How can I indicate who last edited a worksheet that will be printed?  Ultimately I'd like my header to read: Last edited on [date] [time] by [name of person who made most recent edit].

1 Reply

You could use the following VBA code to add the Last Author to every worksheet header

 

Let me know if you need assistance in pasting this into a module (via Alt+F11) and then right clicking on the file name and Inserting a module 

image.png

 

Option Explicit

Sub LastEdit()

Dim wks As Worksheet
Dim CustomHeader As String
Dim LastAuthor As String
Dim ActiveUser As String

LastAuthor = ActiveWorkbook.BuiltinDocumentProperties("Last Author")
' ActiveUser = Application.UserName   'could use ActiveUser instead of Last Author


CustomHeader = "Last Edited on " & Now() & " by " & LastAuthor


For Each wks In Worksheets

    wks.PageSetup.RightHeader = CustomHeader

Next wks


End Sub