I want to write a code that can automatically change the year of a date value after getting into a new financial year (e.g. October). Here's only the concept of what I had in mind
For example, when I get into Oct, 2009, the finYear will update its year value to 2009 (from y2k). If I'm running the codes again in e.g. Mar, 2010, the finYear will update its year value to 2009 as well.
I want to directly change the year value of finYear. Is there other ways instead of using a loop to do DateAdd until it reach the current year?
Code:
Dim finYear as Date
Dim intYear as Integer
finYear = DateValue("01/10/2000")
intYear = Year(Date)
'Below will be in words instead of code
if (Month(date) >= Month(finYear)) then[INDENT](year value of finYear) = intYear[/INDENT]
else[INDENT](year value of finYear) = intYear-1[/INDENT]
end if
I want to directly change the year value of finYear. Is there other ways instead of using a loop to do DateAdd until it reach the current year?
Comment