vba check if date = 00:00:00 code example
Example: vba check if date = 00:00:00
Function IsNullDate(ByVal d As Date) As Boolean
If d = CDate("00:00:00") Then
IsNullDate = True
Else
IsNullDate = False
End If
End Function
Sub CheckDate()
Dim d1, d2 As Date
d1 = Date
d2 = Empty
MsgBox "d1= " & IsNullDate(d1) & ", d2= " & IsNullDate(d2)
End Sub
' Running `CheckDate()` has the following output:
' d1= False, d2= True