End of Month Date in Header

C

CarrieW

I would like the last date of the current month to appear in the worksheet
header. Can eomonth be used in a macro?
 
D

Dave Peterson

You could, but you could use a simpler formula:


Dim myDate As Date
myDate = Date - Day(Date)

With Worksheets("Sheet1").PageSetup
.LeftHeader = Format(myDate, "mmmm dd, yyyy dddd")
End With


Subtracting 18 from May 18th, gives May the 0th. Or the last day of April.
 
Top