Return last day of a current month

This tutorial shows how to return the last day of a current month using an Excel formula or VBA

Example: Return last day of a current month

Return last day of a current month

METHOD 1. Return last day of a current month using Excel formula

EXCEL

=EOMONTH(NOW(),0)
This formula uses the Excel EOMONTH and NOW functions to calculate the last day of a current month. Using the NOW function inside the EOMONTH function, with the months criteria of 0, will return the last day in the current month, in date format.

METHOD 1. Return last day of a current month using VBA

VBA

Sub Last_Days_of_a_Current_Month()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'return the last day in a current month
ws.Range("D5") = Application.WorksheetFunction.EoMonth(Now(), 0)

End Sub

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code.

Explanation how to extract the last day of a current month

EXPLANATION

EXPLANATION

This tutorial shows how to get the last day of a current month through the use of an Excel formula or VBA.
Both the Excel formula and VBA methods make use of the EOMONTH and NOW functions, with a month criteria of 0, to return the last day of a current month.
FORMULA
=EOMONTH(NOW(),0)

RELATED TOPICS

Related Topic Description Related Topic and Description
How to return the number of days in a current month using Excel and VBA
How to return the number of days in a specific month using Excel and VBA
How to return the previous month based on the current month using Excel and VBA
How to return the next month based on the current month using Excel and VBA

RELATED FUNCTIONS

Related Functions Description Related Functions and Description
The Excel NOW function returns the current date and time