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


Excel logoThis 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.

 

Posted in:
About the Author

Carol Bratt

Carol holds A+, MCP, and MOS computer certifications and is the resident DCT Office expert. She trains the staffs of small law firms in the use of Microsoft Office applications and has authored many books covering Microsoft Office as well as written articles for Infopackets, TechnoLawyer, and Digital Harbor. For more Microsoft Office tips visit Carol's Corner Office or follow Carol on FaceBook and Twitter.

There are no comments

Your email address will not be published. Required fields are marked *