Jump to content
Sign in to follow this  
litlmike

+1 to Date Macros?

Recommended Posts

litlmike

My goal is to take today's date and put it into an excel file (this I can do), and then go to the next row and add 1 to the date, doing this for 365 days. So starting today, I should have 06/14/2007 through 06/14/2007, one in each row.

The problem is the only way I can think to do this is to create a rule for every month because every month has a different number of days in it. So I would have to +1 to todays date, until the Day is =30, then I would have to +1 to the Month, and do that 12 times. Though it would work, it seems ridiculous, it seems that there would be a way to just +1 to today's date and loop that. (i.e. February would be +1 to the Day until Day=28, then +1 to the Month)

Sorry, my help file does not work, and I am sorry if this is in the help file already.

Thanks.

#include <ExcelCOM_UDF.au3>

For $iCC = 1 To 365
    _ExcelWriteCell($oExcel, @MON & "/" & @MDAY & "/" & @YEAR, $sRangeOrRow, $iColumn) ; Date
        $sRangeOrRow += 1
WEnd
Edited by litlmike

Share this post


Link to post
Share on other sites
litlmike

look at _DateAdd

Ahhh... that sounds good. Since my Help File is broken, and since those UDF's cannot be found in the Online Documentation, could you provide me with the Syntax for _DateAdd .

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×