Ayın Son Gününü Bul - Microsoft Excel


Verilen tarihe ait ayın son gününü sayı olarak veren VBA kodudur.

Kod


Option Explicit

Public Function AyinSonGunu(ByVal tarih As Date) As Byte
    Dim sonGun As Byte
    
    sonGun = DatePart("d", DateAdd("d", -1, DateAdd("m", 1, DateAdd("d", -DatePart("d", tarih) + 1, Date))))
    
    AyinSonGunu = sonGun
End Function

Etiketler
microsoft excel microsoft excel vba microsoft excel vba tarih saat işlemleri