You are here:

Excel/Auto Backup Using Date


I would like to Auto Backup my workbook, using a Cell reference and the date as the backup workbook name.

I would want this to kick in every time I Close the workbook.

Thank you,

Hey Paul,
You can use a Workbook_before close event. This code belongs in the Workbook Module.

When you close the Active Workbook.
First it saves the original workbook, then it saves it to the backup folder.
Be sure to edit the fdir to the actual folder address on your computer.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
   Dim fname As String, fdir As String, fnm As Range
   Dim MyDate, MyMonth
   Set fnm = Sheets(1).Range("A1")
   fdir = "C:\Backup\"
   MyDate = Date
   MyMonth = Month(MyDate)
   If ThisWorkbook.Saved = False Then
   End If
   fname = fdir & MonthName(MyMonth) & "-" & Day(Date) & "-" & Year(Date) & "-" & fnm & ".xls"
   Application.DisplayAlerts = 0
   ThisWorkbook.SaveAs Filename:=fname
   Application.DisplayAlerts = 1
End Sub

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Dave Morrison


I can answer most excel questions My Website is


I have been working with spreadsheets since 1991. I am a self-trained excel developer since 2005.

My website

Business admin. U of R.

Awards and Honors
Microsoft Excel MVP 2011-2012

©2016 All rights reserved.