ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel 2007: Add year to footer (https://www.excelbanter.com/excel-discussion-misc-queries/189437-excel-2007-add-year-footer.html)

Petemeister2k

Excel 2007: Add year to footer
 
Hello,

I need to add an autotext field (or whatever the correct term) is so I
can add the copyright year to the footer, so the copyright year can be
updated as needed.

How do I do this? I can easily add the date, but I only want a year field.

Thanks,

Pete

Bob Phillips

Excel 2007: Add year to footer
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup

.LeftFooter = Year(Date)
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Petemeister2k" wrote in message
...
Hello,

I need to add an autotext field (or whatever the correct term) is so I
can add the copyright year to the footer, so the copyright year can be
updated as needed.

How do I do this? I can easily add the date, but I only want a year
field.

Thanks,

Pete




Petemeister2k

Excel 2007: Add year to footer
 
I don't have a File menu anymore with Excel 2007, and I'm not sure how to add
this code. Is there a non-code way to do this? I will need to share this
with other people who will maintain the files and want things as simple as
possible.

Regards,

Pete

"Bob Phillips" wrote:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup

.LeftFooter = Year(Date)
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Petemeister2k" wrote in message
...
Hello,

I need to add an autotext field (or whatever the correct term) is so I
can add the copyright year to the footer, so the copyright year can be
updated as needed.

How do I do this? I can easily add the date, but I only want a year
field.

Thanks,

Pete






All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com