Add Days to an Excel Header or Footer Date with VBA
Question details
Calculate a future date and display it in an Excel worksheet header or footer.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants a header or footer to show a date a set number of days after the current date.
- Observed behavior
- Excel's built-in &[Date] field displays the current date but cannot add days by itself.
Open the workbook in desktop Excel and identify the worksheet and header or footer position you want to update. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) if you want to keep VBA code.
Use VBA to insert a future date in the header or footer
Use a macro to calculate a date offset and write the result to the active worksheet's page setup.
The &[Date] field cannot perform date arithmetic. The macro writes a formatted date as static text, so run it again whenever you need the date refreshed.
In desktop Excel, open the Developer tab and select Visual Basic. If the Developer tab is hidden, enable it in Excel's ribbon settings.
In the VBA editor, select your workbook in the Project pane, then choose Insert > Module.
Paste this code into the module: Sub SetFutureHeaderDate() ActiveSheet.PageSetup.CenterHeader = Format(Date + 3, "m/d/yyyy") End Sub Change 3 to the number of days you want to add. To use the center footer instead, replace CenterHeader with CenterFooter.
Return to Excel, select the target worksheet, and choose Developer > Macros. Select SetFutureHeaderDate and click Run, then open File > Print to check the header or footer preview.

Edit spreadsheet headers and footers with WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface for opening and editing Office files. It can help you work with headers and footers, but it does not fix Excel's date-field limitation; VBA support can vary by WPS version.

Frequently Asked Questions
Can I add days directly to Excel's &[Date] header field?
No. The &[Date] field displays the current date and does not support arithmetic. Use VBA to calculate the offset and write the result to PageSetup.
How do I put the future date in the footer instead?
In the macro, replace ActiveSheet.PageSetup.CenterHeader with ActiveSheet.PageSetup.CenterFooter, then run the macro on the target worksheet.
Will the VBA-generated date update automatically tomorrow?
No. The macro inserts formatted text rather than a live date field. Run it again before printing to calculate a fresh date.
Why should I save the workbook as an XLSM file?
The .xlsm format retains VBA code. Choose File > Save As and select Excel Macro-Enabled Workbook to keep the macro in the workbook.




