Public Function AyinSonGunu(ByVal GecerliTarih As Date) As Byte Dim SonGun As Byte SonGun = DatePart("d", DateAdd("d", -1, DateAdd("m", 1, _ DateAdd("d", -DatePart("d", GecerliTarih) + 1, Date)))) AyinSonGunu = SonGun End Function Private Sub Command1_Click() MsgBox Date & " tarihine ait ayin son günü : " & AyinSonGunu(Date) End Sub