ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   current date in header (https://www.excelbanter.com/setting-up-configuration-excel/26374-current-date-header.html)

RachelN

current date in header
 
I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!

Gord Dibben

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!



RachelN

Gord,
Thanks for the code. I had no problem inserting this into VBA code and the
footer displayed 5/17/2005 with no problema. Now tomorrow, it should display
5/18/2005 and then I will be a happy camper.
Rachel

"Gord Dibben" wrote:

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!




Gord Dibben

Make that Control PanelDate and Time, not Regional Options.


Gord

On Thu, 19 May 2005 14:59:21 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

You can test right now if you want to change your system date in Regional
Options.

Close Excel and change the date then open the workbook.

But.....it will work so no need to test.


Gord Dibben Excel MVP

On Tue, 17 May 2005 13:06:08 -0700, "RachelN"
wrote:

Gord,
Thanks for the code. I had no problem inserting this into VBA code and the
footer displayed 5/17/2005 with no problema. Now tomorrow, it should display
5/18/2005 and then I will be a happy camper.
Rachel

"Gord Dibben" wrote:

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!




RachelN

Gord,
When I opened the spreadsheet today, the date displayed is 5/17/2005. I'm
looking for some code to display the dynamic current date, so that it will
change from day to day.
Any ideas for that?
Rachel


"RachelN" wrote:

Gord,
Thanks for the code. I had no problem inserting this into VBA code and the
footer displayed 5/17/2005 with no problema. Now tomorrow, it should display
5/18/2005 and then I will be a happy camper.
Rachel

"Gord Dibben" wrote:

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!




Dave Peterson

This line:

ActiveSheet.PageSetup.RightFooter = Date

Adjusts the rightfooter of the activesheet. (If you enabled macros.)

If you want a specific worksheet's footer to change, then you can be more
specific.

worksheets("sheet99").PageSetup.RightFooter = Date



RachelN wrote:

Gord,
When I opened the spreadsheet today, the date displayed is 5/17/2005. I'm
looking for some code to display the dynamic current date, so that it will
change from day to day.
Any ideas for that?
Rachel

"RachelN" wrote:

Gord,
Thanks for the code. I had no problem inserting this into VBA code and the
footer displayed 5/17/2005 with no problema. Now tomorrow, it should display
5/18/2005 and then I will be a happy camper.
Rachel

"Gord Dibben" wrote:

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!



--

Dave Peterson

Gord Dibben

You can test right now if you want to change your system date in Regional
Options.

Close Excel and change the date then open the workbook.

But.....it will work so no need to test.


Gord Dibben Excel MVP

On Tue, 17 May 2005 13:06:08 -0700, "RachelN"
wrote:

Gord,
Thanks for the code. I had no problem inserting this into VBA code and the
footer displayed 5/17/2005 with no problema. Now tomorrow, it should display
5/18/2005 and then I will be a happy camper.
Rachel

"Gord Dibben" wrote:

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!





Gord Dibben

Rachel

Did you place the code in the Thisworkbook module?

Works for me.

Test by temporarily changing your system date in Control PanelDate and Time.

Then re-open the workbook.


Gord

On Thu, 19 May 2005 12:25:29 -0500, Dave Peterson
wrote:

This line:

ActiveSheet.PageSetup.RightFooter = Date

Adjusts the rightfooter of the activesheet. (If you enabled macros.)

If you want a specific worksheet's footer to change, then you can be more
specific.

worksheets("sheet99").PageSetup.RightFooter = Date



RachelN wrote:

Gord,
When I opened the spreadsheet today, the date displayed is 5/17/2005. I'm
looking for some code to display the dynamic current date, so that it will
change from day to day.
Any ideas for that?
Rachel

"RachelN" wrote:

Gord,
Thanks for the code. I had no problem inserting this into VBA code and the
footer displayed 5/17/2005 with no problema. Now tomorrow, it should display
5/18/2005 and then I will be a happy camper.
Rachel

"Gord Dibben" wrote:

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the &[Date] into
a custom header so that the current date always shows up in the header when
you open a worksheet? When I use the &[Date], it places the current date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to do
this? Thanks for your help!




sharon ARdrey

=today()

"RachelN" wrote in message
...
Gord,
When I opened the spreadsheet today, the date displayed is 5/17/2005. I'm
looking for some code to display the dynamic current date, so that it will
change from day to day.
Any ideas for that?
Rachel


"RachelN" wrote:

Gord,
Thanks for the code. I had no problem inserting this into VBA code and
the
footer displayed 5/17/2005 with no problema. Now tomorrow, it should
display
5/18/2005 and then I will be a happy camper.
Rachel

"Gord Dibben" wrote:

Rachel

Several ways to do this. All involve VBA code.

Are you OK with that?

Private Sub Workbook_Open()
ActiveSheet.PageSetup.RightFooter = Date
End Sub

Alternative.........

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightFooter = Date
End Sub

If you want all sheets to have the current date replace with this code.

Private Sub Workbook_Open()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightFooter = Date
Next
End Sub

To enter this code, right-click on the Excel icon left of "File" on
menu and
select "View Code". Paste one of the above in there.


Gord Dibben Excel MVP


On Mon, 16 May 2005 13:30:11 -0700, "RachelN"
wrote:

I need to insert the TODAY function or other parameter after the
&[Date] into
a custom header so that the current date always shows up in the header
when
you open a worksheet? When I use the &[Date], it places the current
date,
but when I open it up the next day, it's got the old date. I need the
current date to display each day I open the file. Anybody know how to
do
this? Thanks for your help!






All times are GMT +1. The time now is 11:04 AM.

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