ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   date confusion (https://www.excelbanter.com/excel-programming/436040-date-confusion.html)

evelin via OfficeKB.com

date confusion
 
hi
I have set in program cell(x,2).numberformat = Dateserial(dd-mm-yy).
but while running program if cells(x,2).value= cells(x.2)+1 or cells(x,2).
value=Dateserial(yr+1,mth,dt), or cells(x,2).value=Dateserial(yr,mth,dt+1)
etc is done not always working properly if tody it works tomorrow it won't

A kinder garten type question, I know . still i long for help
thanks

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200911/1


Rick Rothstein

date confusion
 
The value returned from the DateSerial function is a Date, not a String...
the NumberFormat property requires a (format pattern) String. Try it this
way...

Cell(x, 2).NumberFormat = "dd-mm-yy"

--
Rick (MVP - Excel)


"evelin via OfficeKB.com" <u54234@uwe wrote in message
news:9ef199870fda6@uwe...
hi
I have set in program cell(x,2).numberformat = Dateserial(dd-mm-yy).
but while running program if cells(x,2).value= cells(x.2)+1 or cells(x,2).
value=Dateserial(yr+1,mth,dt), or
cells(x,2).value=Dateserial(yr,mth,dt+1)
etc is done not always working properly if tody it works tomorrow it won't

A kinder garten type question, I know . still i long for help
thanks

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200911/1



evelin via OfficeKB.com

date confusion
 
hi Rick Rothstein
Thanks i have to try that

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200911/1



All times are GMT +1. The time now is 12:58 PM.

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