excel

How to Determine the Day of the Year with Macros in Excel

This tip may not be for everyone, but for those who write macros in VBA and have a need for it, it will certainly be appreciated.

Sometimes when you are creating a macro in VBA, there comes a time when you need to determine the current day of the year. For example, you might want to know that March 15 is the 74th day of the year.

Luckily, VBA includes a nifty little function that will allow you to speedily determine the current day of the year and the bonus is – it’s very easy to to!

Follow the steps below to learn how:

iThisDay = DatePart("y", Date)

When executed, iThisDay will be equal to the current day number.

 

Exit mobile version

WHY NOT SUBSCRIBE TO OUR NEWSLETTER?

Get great content like this delivered to your inbox!

It's free, convenient, and delivered right to your inbox! We do not spam and we will not share your address. Period!