Automatically Add One Year to a Date in Excel with VBA
Question details
Automatically replace a date entered or edited in cell A1 with the date one year later.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user enters or edits a date in cell A1 and wants the same cell to update automatically.
- Observed behavior
- After a date is entered or edited in A1, the cell should display the corresponding date one year later.
Open the workbook in desktop Excel and check that A1 is formatted as a date. You will need to save the workbook as an Excel Macro-Enabled Workbook and enable macros from a trusted source.
Use a Worksheet_Change macro to update A1
Use this approach when the date must be replaced in the same cell immediately after entry or editing.
The worksheet event checks whether an edit includes A1 and whether its value is a date. It temporarily disables events to prevent the macro's own change from triggering the event again.
In desktop Excel, right-click the tab of the worksheet containing A1 and select View Code.
Paste this code into the worksheet code window: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Me.Range("A1"), Target) Is Nothing Then Exit Sub If Not IsDate(Me.Range("A1").Value) Then Exit Sub On Error GoTo CleanUp Application.EnableEvents = False Me.Range("A1").Value = DateAdd("yyyy", 1, Me.Range("A1").Value) CleanUp: Application.EnableEvents = True End Sub
Choose File > Save As and select Excel Macro-Enabled Workbook (*.xlsm). When reopening the file, enable macros if prompted and if you trust the workbook.
Return to the worksheet and enter a date in A1. For example, entering 3/15/2025 should replace it with 3/15/2026, depending on the cell's date format.

Work with date-based spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Its compatibility with Excel formats helps you move everyday spreadsheet work between applications. The Excel VBA event above requires desktop Excel and should not be assumed to run in WPS.

Frequently Asked Questions
Can this macro run in Excel for the web?
No. VBA macros do not run in Excel for the web. Open the workbook in desktop Excel and enable macros from a trusted source.
What happens if I enter February 29 in A1?
DateAdd adjusts the result to a valid date in the following year. For example, February 29, 2024 becomes February 28, 2025.
Will the macro update A1 when a formula recalculates?
No. Worksheet_Change responds to edits, not formula recalculation. A different event and approach would be needed for recalculated values.
Why does the date appear as a number after the macro runs?
Select A1, open Format Cells, and choose a Date format. Excel stores dates as serial numbers, so the cell format controls how the result appears.




