Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Kurtlee
 
Posts: n/a
Default Date formula for footer/header

I'm pretty new to excel. My question is, is there a way to have the date in
the header/footer roll back one day? And if it is a Monday, can it roll back
to Friday? If I use a cell for the date it throws the entire format for a
loop and I end up having an entire row with just 1 thing in it. Any help
would be greatly appreciated.
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Date formula for footer/header

'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

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim dte As Date

dte = Date - 1
If Weekday(dte) = 1 Then
dte = dte - 1
End If
If Weekday(dte) = 7 Then
dte = dte - 1
End If
With ActiveSheet.PageSetup
.LeftFooter = Format(dte, "dd mmm yyyy")
End With
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Kurtlee" wrote in message
...
I'm pretty new to excel. My question is, is there a way to have the date

in
the header/footer roll back one day? And if it is a Monday, can it roll

back
to Friday? If I use a cell for the date it throws the entire format for a
loop and I end up having an entire row with just 1 thing in it. Any help
would be greatly appreciated.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Year-to-date year to date formula Philm Excel Worksheet Functions 1 October 7th 05 02:50 AM
Excel formula with date constraints Warrior Pope Excel Discussion (Misc queries) 3 January 28th 05 03:08 PM
Formula with date constraints Warrior Pope Excel Worksheet Functions 1 January 28th 05 02:11 PM
Date formula Robyn Bellanger Excel Discussion (Misc queries) 2 December 16th 04 12:41 AM
Need help troubleshooting an array formula XLXP on Win2K KR Excel Worksheet Functions 1 December 13th 04 07:41 PM


All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"