Google
 
Web itpro-blogger.blogspot.com
日曜日, 9月 23, 2007

[VBA]月の日数

▼質問
月の日数をを知りたいんだけど・・・。どうしたらできるの?

▼回答
次の関数で取得することができるよ。

Public Function DaysInMonth(ByVal day As Date) As Integer
Dim NextMonth As Variant
Dim EndOfMonth As Variant
NextMonth = DateAdd("m", 1, day)
EndOfMonth = NextMonth - DatePart("d", NextMonth)
DaysInMonth = DatePart("d", EndOfMonth)
End Function

■参考
[AC97]指定された月の日数を取得する方法
http://support.microsoft.com/kb/109703/ja






Comments: コメントを投稿

<< Home

This page is powered by Blogger. Isn't yours?