View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default Datedif incorrect month count - February problem??

I believe Ron forgot to include another UDF called EOM (End Of Month) A
quick google on Ron's name and EOM gives this


-------------------------------------------------------
Function EOM(DT As Date, mnths As Double) As Date
Dim Day1ofDT As Date
Dim temp As Date


Day1ofDT = DT - Day(DT) + 1


'add requisite number of months
temp = DateAdd("m", mnths, Day1ofDT)


'go to end of month


EOM = temp + 32 - Day(temp + 32)


End Function
--------------------------------------------


you can put that in the same module and now it should work (haven't tested
it but I am sure it will)


--

Regards,

Peo Sjoblom



"JMKCT" wrote in
message ...

I've tried using the UDF, but I get a "sub ior function not defined at
"Temp = EOM(d1, i)". Is there a reference I need to load in VBA for
this?
Thanks, JMK


--
JMKCT
------------------------------------------------------------------------
JMKCT's Profile:

http://www.excelforum.com/member.php...o&userid=29394
View this thread: http://www.excelforum.com/showthread...hreadid=491085