-
-
Save magmel48/5a32eb88934ccb3a651cdcc554ef8a89 to your computer and use it in GitHub Desktop.
VBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim text As String | |
Dim d As Date | |
Dim y As Integer | |
text = "28.02.1899" | |
If IsDate(text) Then | |
'Date is correct, let's check validity: date more than 1900 and less than 2010 | |
d = CDate(text) | |
y = Year(d) | |
If Year > 1900 And Year < 2010 Then | |
'Date is valid, let's proceed with needed logic then | |
Else | |
'Year is invalid, let's show a message | |
'Use MsgBox here | |
End If | |
Else | |
'Date is invalid, let's show a message | |
'Use MsgBox here | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment