ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to get month and year from date (https://www.excelbanter.com/excel-programming/359541-re-how-get-month-year-date.html)

ina

how to get month and year from date
 
thank you a log but I would like to use datediff between the first date
and and now today but I have a strange result I do not undestand why

Do While datedifferencee 0

currendatemonth = Month(currentdate)
currentdateyear = Year(currentdate)


difference = datediff("m", todaydate, currentdate)

datedifferencee = CInt(difference)


currentdate = DateSerial(Year(currentdate), Month(currentdate) + i, 0)


currendatemonth = currendatemonth + 1

Loop

Ina


Bob Phillips[_6_]

how to get month and year from date
 
Now is Date not todaydate. Also your code makes no sense to me, I am not
seeing the link between this code and your original request. What exactly
are you trying to do?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"ina" wrote in message
ups.com...
thank you a log but I would like to use datediff between the first date
and and now today but I have a strange result I do not undestand why

Do While datedifferencee 0

currendatemonth = Month(currentdate)
currentdateyear = Year(currentdate)


difference = datediff("m", todaydate, currentdate)

datedifferencee = CInt(difference)


currentdate = DateSerial(Year(currentdate), Month(currentdate) + i, 0)


currendatemonth = currendatemonth + 1

Loop

Ina





All times are GMT +1. The time now is 10:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com