Sub うるう年判定()
Dim Num As Integer
Dim div_4, div_100, div_400 As Integer
Dim odd_4, odd_100, odd_400 As Currency
Num = 2100 ’ここに年を手入力
div_4 = Num / 4
odd_4 = Int(Num / 4)
div_100 = Num / 100
odd_100 = Int(Num / 100)
div_400 = Num / 400 Mod 1
odd_400 = Int(Num / 400)
If div_400 - odd_400 = 0 Or div_100 - odd_100 = 0 Then
Debug.Print Num & "年はうるう年ではありません、2月28日までです" & div_400 & "," & odd_400 & "," & "400"
Else
If div_4 - odd_4 = 0 Then
Debug.Print Num & "年はうるう年で2月29日があります" & div_4 & "," & odd_4 & "," & "4"
Exit Sub
Else
Debug.Print Num & "年はうるう年で2月29日があります" & div_4 & "," & odd_4 & "," & "other"
Exit Sub
End If
End If
End Sub