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)
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)
=now()+5
this usually well.
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)
>
> --
> 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
Thanks to both of you, I found a solution using input from each of you.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks