View Single Post
  #2   Report Post  
Harald Staff
 
Posts: n/a
Default

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