Finding The Last Day Of The Month

Author: Microsoft

Type any date inside the InputBox ,and get the last day of month in this date.

Form Code

Private Sub Form_Load()
   Dim TEMP2 As Date
   Dim
nLastDay As Integer
  
TEMP2 = InputBox$("Please Enter A Date", "LastDay")
   nLastDay = DatePart("d", DateAdd("M", 1, TEMP2 - DatePart("d", TEMP2)))
   MsgBox nLastDay
End Sub

Go Back