Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Date Last Edited.

Date Last Edited

by Allen Wyatt
(last updated November 25, 2019)


As part of setting up a worksheet, you may want the header or footer to contain the date that the workbook was last edited. Excel doesn't maintain this information, but it does allow you to perform macros whenever certain events occur, such as changes to a workbook. All you need to do is add a macro such as the following to the ThisWorkbook object in the VBA Editor:

Private Sub Workbook_SheetChange(ByVal _
  Sh As Object, ByVal Target As Excel.Range)
    ActiveSheet.PageSetup.CenterFooter = _
      "Worksheet Last Changed: " & _
      Format(Now, "mmmm d, yyyy hh:mm")
End Sub

The macro results in each footer on each worksheet in the workbook having separate dates and times on them, since each worksheet would be updated at different times. You can change the destination property (.CenterFooter) to one of the other header or footer properties (.LeftHeader, .CenterHeader, .RightHeader, .LeftFooter, .RightFooter) as desired.

You may want the header or footer to instead include the date that the workbook was last saved. (This is what many people really view as the "last edit date.") The information is visible in the Properties dialog box for a worksheet, but Excel has no menu selection or other command that allows you to insert this date into a header or footer. Instead, you must use a macro to add the desired information.

The best way to accomplish the task is to add a macro to the ThisWorkbook object that is triggered just before a workbook is saved:

Private Sub Workbook_BeforeSave(ByVal _
  SaveAsUI As Boolean, Cancel As Boolean)
    Dim sht
    For Each sht In Sheets
        sht.PageSetup.CenterFooter = _
          "Workbook Last Saved: " & _
          Format(Now, "mmmm d, yyyy hh:mm")
End Sub

This macro steps through each worksheet in the workbook and changes every center footer to have the date that the workbook was saved.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11604) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Date Last Edited.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Sending Drawing Objects to the Back or Front

Drawing objects can be placed in a document in such a way that they overlap with each other. If you want to arrange those ...

Discover More

Showing Visited Hyperlinks

Many people like to use Excel to keep track of lists of hyperlinks. Want to keep a permanent record of which hyperlinks ...

Discover More

Protecting Worksheets from Deletion

If you share a workbook with others in your office, you will probably want to make sure that some of the worksheets don't ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Creating Long Page Footers

Ever wish that you could create nice, long footers that appear at the bottom of each page when you print your worksheet? ...

Discover More

Copying Headers and Footers

Need to copy headers and footers from one worksheet to another? How about from one workbook to another? Here are some ...

Discover More

Selective Headers and Footers

Want to print different headers or footers on different parts of your worksheet? Excel has no inherent way to do this, ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 5?

2016-03-01 05:46:15


@ Walter, should also work

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ActiveSheet.PageSetup.LeftFooter = _
"Worksheet Last Changed: " & _
Format(Now, "dd-mmm-yyyy hh:mm") &_
vbLf & _
"by: " & Application.UserName
End Sub

2016-02-29 11:45:25

Derek Gerry

Walter, The code below will get the user name for you.

Declare Function wu_GetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
As Long
Function ap_GetUserName() As Variant

Dim strUserName As String
Dim lngLength As Long
Dim lngResult As Long

'-- Set up the buffer
strUserName = String$(255, 0)
lngLength = 255

'-- Make the call
lngResult = wu_GetUserName(strUserName, lngLength)

'-- Assign the value
ap_GetUserName = Left(strUserName, InStr(1, strUserName, Chr(0)) - 1)

End Function

2016-02-29 11:39:45

Michael (Micky) Avidan

@Abdul hamid,
In case Peter Atherton better understood your request, than I did, try the following macro (make sure you have at least 12 sheets in your Workbook):
Sub NameSheets()
On Error Resume Next
For M = 1 To 12
Worksheets(M).Name = MonthName(M)
End Sub
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)

2016-02-29 11:19:19

Peter Atherton


I don't know what happened to the code, You do want to rname the sheets?

Sub NameSheets()
Dim i As Integer
Dim va As Variant
On Error GoTo 0
va = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", _
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
For i = 1 To Worksheets.Count
Worksheets(i).Name = va(i - 1) & format(Year(Now()), "-yy")
Next i
End Sub

2016-02-29 07:45:25

Walter A

I have a shared workbook with several named sheets, how would you change the macro to the last user and date? the user is unique to the computer and in code so their name doesn't actually appear.

2016-02-29 05:26:10

Michael (Micky) Avidan

If you prefer a Macro - try the following (change the value of the variable Num from 1-12):
Sub MonthsName()
Num = 5
MsgBox MonthName(Num)
End Sub
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)

2016-02-29 05:19:46

Michael (Micky) Avidan

Suppose you have the number 5 un cell A1.
In cell B1 type: =DATE(2016,A1,1) and custom format that cell as: mmmm.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)

2016-02-28 19:52:18


Hi. I have a spreadsheet that is on a shared drive accessed by 1/2 dozen people, but the actual spreadsheet is not "shared" as such - i.e. only one person can open it at a time.
Is there a way to record who last saved the sheet?

2016-02-28 10:43:27

Peter Atherton


Try this macro, it uses month short name and adds the last two digits of the year.

To change the names in the array fill the rest of the month''s name between each quotation.

To remove the year change the line Worksheets(i).Name = va(i - 1) & format(Year(Now()), "-yy")

Worksheets(i).Name = va(i - 1)


2016-02-27 05:35:22


How to convert Month in letter format mean if any excel sheet numbers are written like 1,2,3,4 etc and required to be converted in letter like January,February,March,April etc.

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.