ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   End of Month Date in Header (https://www.excelbanter.com/excel-discussion-misc-queries/231293-end-month-date-header.html)

CarrieW

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

Dave Peterson

End of Month Date in Header
 
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.


CarrieW wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com