getting string output of 1900 from the date input vba -


i trying keep date of event occurrence. having trouble way data has been defined. instead of showing actual date output showing in 1900 format (like 10/1/1900)

here code:

dim arr_rate date dim d(528) date = 3 500 arr_rate = -3.7 * log(rnd) '<~~ arrival interval d(2) = cdate(1 / 1 / 2006) d(i) = d(i - 1) + arr_rate worksheets("a").cells(i, "e").value = cdate(d(i))   next  

i tried have sdate format in code not give me numbers in proper format (1/1/2006). how can print in proper format? have read post in stackover flow not helpful!

without quotes 1\1\12006 mathematical expression , not date.

sub test()      dim arr_rate date     dim d(528) date     = 3 500         arr_rate = -3.7 * log(rnd) '<~~ arrival interval         '<~~ using cdate, use string. otherwise 1 / 1 / 2006 evaluates 4.98504486540379e-04         d(2) = cdate("1 / 1 / 2006")         d(i) = d(i - 1) + arr_rate         worksheets("sheet1").cells(i, "e").value = cdate(d(i))     next   end sub 

Comments