View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Nils Titley Nils Titley is offline
external usenet poster
 
Posts: 84
Default Convert the date to day of the week.

Ron,

I am not sure this is helping....

I changed what you have because I don't have #2/12/2008# I have "02/12/2008".

When I do that I get debug print
A) 02/12/2008 = 39490 120208 (ddmmyy)
B) 12/02/2008 = 39784 021208 (ddmmyy)

A) ActiveCell.Offset(0, 17).Value = Format(CLng(dt), "ddmmyy")
B) ActiveCell.Offset(0, 18).Value = Format(CLng(dt2), "ddmmyy")
Results
A) 120208
B) 21208

I tried, what I call casting, RunDate(MyNum) as
CLng(RunDate(MyNum))

ActiveCell.Offset(0, 0).Value = Format(CLng(RunDate(MyNum)), "ddmmyy")
Data = 12/02/2008
Result = 21208
Expecte as above 120208

Please, I don't get it and don't know what to do.

Thanks

"Ron Rosenfeld" wrote:

On Sun, 23 Mar 2008 05:14:00 -0700, Nils Titley
wrote:

Ron,

I confess, I don't know how to get the numeric value of it?


Perhaps this will help:


=====================================
Option Explicit
Sub foo()
Const dt As Date = #2/12/2008#
Const dt2 As Date = #12/2/2008#

Debug.Print CLng(dt), Format(dt, "dddd, dd-mmm-yyyy")
Debug.Print CLng(dt2), Format(dt2, "dddd, dd-mmm-yyyy")

End Sub
====================================
--ron