Date: Week in header

H

happysak

I need to automatically add to a header the dates of the week (Monday through
Friday) that the current date falls in. For example, today is 12/04/2007. I
want the header to also show that this week is 12/03/07-12/07/07. Any help?
Thanks
 
R

Roger Govier

Hi

Try
=TEXT((A1-WEEKDAY(A1)+2),"dd/mm/yy")& " - "
&TEXT((A1-WEEKDAY(A1))+6,"dd/mm/yy")
 
G

Gary''s Student

Put the following macro in the workbook code area:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
d = Date
d1 = d - Application.WorksheetFunction.Weekday(d) + 2
d2 = d1 + 4
ActiveSheet.PageSetup.CenterHeader = d1 & "-" & d2
End Sub
 
H

happysak

This might have worked with a little tweaking. You gave me lots of ideas I
can use another time. In the meantime, next reply worked. Thanks for your
help.
 
H

happysak

This worked just fine. I actually wanted the week on the left under some
other dates, text, etc., but I was able to figure out how to do that. This
will make my life a whole lot easier. Thank you for your expertise and for
sharing it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top