Option Explicit
Sub TestBissextile()
MsgBox estBissextile(Range("$B$5").Value)
End Sub
Function estBissextile(hAnnee As Integer) As Boolean
If hAnnee <= 0 Then
Err.Raise 13
End If
estBissextile = Day(DateSerial(hAnnee, 2, 29)) = 29
End Function
Sub TestNbJoursMois()
MsgBox nbJoursMois(Range("$B$10").Value, Range("$C$10").Value)
End Sub
Function nbJoursMois(hAnnee As Integer, hMois As Integer) As Integer
If hAnnee < 0 Then
Err.Raise 13
End If
If hMois < 1 Or hMois > 12 Then
Err.Raise 13
End If
nbJoursMois = Day(DateSerial(hAnnee, hMois + 1, 0))
End Function
Sub TestPremJourDuMois()
MsgBox premJourDuMois(Range("$B$15").Value, Range("$C$15").Value)
End Sub
Function premJourDuMois(hAnnee As Integer, hMois As Integer) As Date
If hAnnee <= 0 Then
Err.Raise 13
End If
If hMois < 1 Or hMois > 12 Then
Err.Raise 13
End If
premJourDuMois = DateSerial(hAnnee, hMois, 1)
End Function
Sub TestDernJourDuMois()
MsgBox dernJourDuMois(Range("$B$21").Value, Range("$C$21").Value)
End Sub
Function dernJourDuMois(hAnnee As Integer, hMois As Integer) As Date
If hAnnee <= 0 Then
Err.Raise 13
End If
If hMois < 1 Or hMois > 12 Then
Err.Raise 13
End If
dernJourDuMois = DateSerial(hAnnee, hMois + 1, 0)
End Function