ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date in Header (https://www.excelbanter.com/excel-programming/354156-date-header.html)

PBANKS[_4_]

Date in Header
 

How can I manipulate the date in the header for a date 5 days from now
or five days from anytime a sheet is printed. (With a Macro):confused

--
PBANK
-----------------------------------------------------------------------
PBANKS's Profile: http://www.excelforum.com/member.php...fo&userid=3137
View this thread: http://www.excelforum.com/showthread.php?threadid=51576


archivesgirl

Date in Header
 

=now()+5
this usually well.


--
archivesgirl
------------------------------------------------------------------------
archivesgirl's Profile: http://www.excelforum.com/member.php...o&userid=31827
View this thread: http://www.excelforum.com/showthread...hreadid=515761


Dave Peterson

Date in Header
 
You'll have to use some VBA to to this.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Me.Worksheets("Sheet1").PageSetup
.LeftHeader = Format(Date+5, "mm/dd/yyyy")
End With
End Sub

If you want to try...

rightclick on the excel icon to the left of the File|Edit|View toolbar.
Select view code and paste that subroutine into the code window.

Change the sheet name that you need (and .leftheader to what you need) and back
to excel to do File|Print preview.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

If you want to read more about these kinds of events:

Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

PBANKS wrote:

How can I manipulate the date in the header for a date 5 days from now,
or five days from anytime a sheet is printed. (With a Macro):confused:

--
PBANKS
------------------------------------------------------------------------
PBANKS's Profile: http://www.excelforum.com/member.php...o&userid=31370
View this thread: http://www.excelforum.com/showthread...hreadid=515761


--

Dave Peterson

PBANKS[_5_]

Date in Header
 

Thanks to both of you, I found a solution using input from each of you.


--
PBANKS
------------------------------------------------------------------------
PBANKS's Profile: http://www.excelforum.com/member.php...o&userid=31370
View this thread: http://www.excelforum.com/showthread...hreadid=515761



All times are GMT +1. The time now is 02:29 PM.

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