I
ina
Hello,
I have this sub which needs to give me each end of month between the
first date and now
Dim diffdatemonth()
dim currentdate, todaydate as date
dim currentmonth, todaymonth, currentyear as date
dim inceptiondate as date
dim difference as string
dim i as integer
dim datedifference as integer
inceptiondate = "2006/01/06"
todaydate = Now()
currentdate = DateSerial(Year(inceptiondatedate), Month(inceptiondate)
+ 1, 0)
' the current date it is the first end of month so here I would like to
have 2006/01/31
currentmonth = Month(currentdate)
todaymonth = Month(todaydate)
datedifference = 1
i = 1
'until the difference beetween currentdate and todaydate it is greater
than 0
Do While datedifference > 0
currentmonth = Month(currentdate)
currentyear = Year(currentdate)
difference = datediff("d", todaydate, currentdate)
datedifferencee = CInt(difference)
currentdate = DateSerial(currentyear, (currentmonth + i), 1)
difference = datediff("m", todaydate, currentdate)
datedifference = CInt(difference)
currentmonth = currentmonth + 1
Loop
End Sub
I have something wrong in this code and I do not understand why; could
someone to help me
Ina
I have this sub which needs to give me each end of month between the
first date and now
Dim diffdatemonth()
dim currentdate, todaydate as date
dim currentmonth, todaymonth, currentyear as date
dim inceptiondate as date
dim difference as string
dim i as integer
dim datedifference as integer
inceptiondate = "2006/01/06"
todaydate = Now()
currentdate = DateSerial(Year(inceptiondatedate), Month(inceptiondate)
+ 1, 0)
' the current date it is the first end of month so here I would like to
have 2006/01/31
currentmonth = Month(currentdate)
todaymonth = Month(todaydate)
datedifference = 1
i = 1
'until the difference beetween currentdate and todaydate it is greater
than 0
Do While datedifference > 0
currentmonth = Month(currentdate)
currentyear = Year(currentdate)
difference = datediff("d", todaydate, currentdate)
datedifferencee = CInt(difference)
currentdate = DateSerial(currentyear, (currentmonth + i), 1)
difference = datediff("m", todaydate, currentdate)
datedifference = CInt(difference)
currentmonth = currentmonth + 1
Loop
End Sub
I have something wrong in this code and I do not understand why; could
someone to help me
Ina