VBA-Funktion zur Ermittlung, ob übergebenes Jahr ein Schaltjahr ist:
Function isLeapYear(ByVal pYear As Long) As Boolean
' https://www.herber.de/forum/archiv/372to376/373497_Schaltjahr_in_VBA.html
If (pYear Mod 4 = 0 And pYear Mod 100 <> 0) Or _
(pYear Mod 400 = 0) Then IsLeapYear = True
End Function
Anwendungsbeispiel
Dim DaysPerMonth As Variant
DaysPerMonth = Array(0, 31, 28, 31, 30, 31, 30, _
31, 31, 30, 31, 30, 31) ' Option Base 0
If isLeapYear(actYear) Then DaysPerMonth(2) = 29 ' Schaltjahr