View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VBA date in function

Robert,

Does this help? It is a function that returns the number of days

Function DaysInQtr(Quarter As Long, qYear As Long)
Dim StartMonth As Long
Dim EndMonth As Long
Dim DaysBetween As Long

StartMonth = (Quarter - 1) * 3 + 1
EndMonth = Quarter * 3
DaysInQtr = DateSerial(qYear, EndMonth + 1, 0) - DateSerial(qYear,
StartMonth, 1) + 1

End Function


You invoke it with Msgbox DaysInQtr(3,2004) as an example.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"robert burger" wrote in message
...

Bob,
thanks for replying. I was expecting to see a reply on the google group
but i guess this group sees it as well.(i'm new to the newsgroup thing)

Q3 '04 has 92 days and Q1 '04 has 90 days.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!