Forum Home
Press F1
 
Thread ID: 7894 2001-02-21 22:35:00 Excel spreadsheet Guest (0) Press F1
Post ID Timestamp Content User
9042 2001-02-21 22:35:00 I use a spreadsheet with the date in the first column. This is changed every week.

Is it possible for this date in the header/footer to change automatically when the date is changed in the spreadsheet. Does one have to set up a macro or is there an easy way out without going into header/footer and changing the date manually?

Can someone help. Thanks
Guest (0)
9043 2001-02-21 23:22:00 As Headers and Footers only relate to printed output, the easiest way to update the header/footer date would be to capture the Event Procedure 'Workbook_BeforePrint' and have the VB code input the date from the worksheet cell.
The date will appear in the format dd/mm/yy.

The following macro will do as described if placed in the VBA Project 'ThisWorkbook'.
Edit the macro for the correct Cell address and worksheet containing the date, and also the header / footer position required.


Private Sub Workbook_BeforePrint(Cancel As Boolean)

Dim WS As Worksheet
For Each WS In Worksheets
WS.PageSetup.LeftHeader = _
Format(Worksheets('Sheet1').Range('A1').Value)
Next WS
End Sub

Ref: Chip Pearson's site.

HTH
Guest (0)
1