View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
kirkm[_8_] kirkm[_8_] is offline
external usenet poster
 
Posts: 166
Default Need a hand with date calc

On Tue, 3 Mar 2009 22:22:16 -0800 (PST), CurlyDave
wrote:

On Mar 3, 9:13*pm, kirkm wrote:
On Tue, 3 Mar 2009 06:24:20 -0800 (PST), CurlyDave

wrote:
It's all supposed to be one line, it gets split in the forum.


No, No, I reconnected the line ok. Something else is wrong - can't see
what though! *Added, removed various brackets, so don't think its
that. I'm using Excel 2002.

Cheers - Kirk


Lets see how you are entering the formula....


Ok . I can't see if variable e1 is set correctly yet as the
line won't enter.

Sub testDateThing()
Dim e1 As Date
e1 = #12/30/1940#
debug.Print Date(Year(e1),month(e1),day(e1) +
choose(weekday(e1),1,0,-1,-2,-3,3,2,1))
End Sub

Btw when you say 30 Dec 1939 was a Monday,
this gives a Saturday.

? Format(CDate("30 Dec 1939"), "dddd, dd mmmm yyyy. ")

So I'm wrong to assume dddd shows the correct day name
for that Date ?

Thanks - Kirk