Good day!
I just need a little help on how to get the last months date (dd/mm/yyyy) between two dates? I have two date pickers(fromdate & todate). Ex. If fromdate is 24/01/2015 and todate is 24/12/2015, it should enumerate the end of the months starting fromdate to todate. So the result is like below:
31/01/2015
28/02/2015
31/03/2015
...
...
...
31/12/2015
I currently have the ff. code, but it does not get the end of the day of the month, instead it shows only the next date of the month the same as the previous date.
Dim lastmonthdates As Date
lastmonthdates = dtfrom.Value
While DateSerial(Year(lastmonthdates), Month(lastmonthdates), 0) < DateSerial(Year(dtto.Value), Month(dtto.Value), 0)
lastmonthdates = DateSerial(Year(lastmonthdates), Month(lastmonthdates) + 1, Day(lastmonthdates))
MsgBox lastmonthdates
Wend
Thank you for helping..!