View Single Post
  #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.