In addition to the solution 1 by
DamithSL[
^] and solution 2
Sergey Alexandrovich Kryukov[
^] here is an implementation of
EOMONTH
formula (function):
Function GetEofMonth(ByVal d As Date) As Date
GetEofMonth = DateSerial(Year(d), Month(d) + 1, -1)
End Function
Usage:
Sub Whatever()
Dim wsh As Worksheet
Dim i As Integer
Set wsh = ThisWorkbook.Worksheets("Sheet1")
i = 2
Do While wsh.Range("A" & i)<>""
wsh.Range("B" & i)= GetEofMonth(CDate(wsh.Range("A" & i)))
i = i+1
Loop
Set wsh = Nothing
End Sub