Home |
Search |
Today's Posts |
#1
|
|||
|
|||
get the latest day of the previous month
hello,
i have a date variable, and i would like with VBA to get the latest day from the previous month many thanks |
#2
|
|||
|
|||
Function LastPrevDate(Dt As Date) As Date
LastPrevDate = DateSerial(Year(Dt), Month(Dt), 0) End Function Sub test() MsgBox LastPrevDate(Now) End Sub HTH. Best wishes Harald "Laurent M" skrev i melding ... hello, i have a date variable, and i would like with VBA to get the latest day from the previous month many thanks |
#3
|
|||
|
|||
In case you specified VBA because you didn't think you could do it with
worksheet functions, the formula is =DATE(YEAR(TODAY()),MONTH(TODAY()),0) On Wed, 26 Jan 2005 06:06:27 -0800, "Laurent M" wrote: hello, i have a date variable, and i would like with VBA to get the latest day from the previous month many thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
UserForm to select current month or earlier | Excel Discussion (Misc queries) | |||
How to extract month number from month name | Excel Discussion (Misc queries) | |||
PivotTable - Count by Month | Excel Worksheet Functions | |||
Pivot Table - Group by Month - Show Items with no data | Excel Discussion (Misc queries) | |||
Insert Month and Year in my worksheet | Excel Worksheet Functions |