-
Saving this here for future use.
[VBA]Option Explicit
Sub test()
Dim X
X = Format(dhLastDayInMonth, "mmm dd, yyyy")
End Sub
Function dhLastDayInMonth(Optional dtmDate As Date = 0) As Date
'http://msdn.microsoft.com/en-us/library/aa227522%28v=vs.60%29.aspx
' Return the last day in the specified month.
If dtmDate = 0 Then
' Did the caller pass in a date? If not, use
' the current date.
dtmDate = Date
End If
'SamT: Add a month to Date, return zeroth date of new month (LDoM)
dhLastDayInMonth = DateSerial(Year(dtmDate), _
Month(dtmDate) + 1, 0)
End Function[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules