arvindraj nagasamy
arvindraj nagasamy

Reputation: 3

Auto populate cell value with dates

I need to auto populate any two cells in Excel with the 16th of the previous month and the 15th of the current month based on the system date.

Example: Current month is January based on the system date.

So cell "A1" and "A2" need to be populated with 16-DEC-2018 and 15-JAN-2019.

Upvotes: 0

Views: 96

Answers (1)

Josh Eller
Josh Eller

Reputation: 2065

You can just use excel formulas like Scott suggested. There's no reason to do this with VBA.

Give cell A1 the formula: =DATE(YEAR(TODAY()),MONTH(TODAY())-1,16)

Give cell A2 the formula: =DATE(YEAR(TODAY()),MONTH(TODAY()),15)

If you need the dates in that specific format, set the cells to have a custom format of dd-mmm-yyyy

Upvotes: 1

Related Questions