Archive for the ‘Microsoft Office’ Category

How to check if cell value is a valid date

There is no built-in function in excel to check the value of the cell is a valid date. In order to do this you have to make your own function.

Follow the steps below.

1. Open the VBA Script Editor of your excel.  Select Tools->Macro->Visual Basic Editor or Press Alt+F11 on the keyboard

vba

2. The Visual Basic Editor window will appear, then Select Insert->Module on the menu.

vba-insert-module

3. Copy and Paste the script below.

Function IsDateValid(cell) As Boolean
If IsDate(cell) Then
IsDateValid = True
Else
IsDateValid = False
End If
End Function

4. Save the module. And thats it your done!

To use the created function  IsDateValid, the figure

vba-validate-date

,

No Comments



SetPageWidth