Dim d As Date = #5/30/2011# Dim d2 As Date = #5/1/2012# Do While d < d2 If d.day <> Date.DaysInMonth(d.year,d.month) d = new Date(d.year,d.month,Date.DaysInMonth(d.year,d.month)) Else Dim d1 As Date = d d = d.Addmonths(1) If d1.day = Date.DaysInMonth(d1.year,d1.month) Then d = new Date(d.year,d.month,Date.DaysInMonth(d.year,d.month)) End If End If output.show(d) Loop