DateValue Function: Return a Variable Containing a Date Value
Excel DateValue Function
DateValue Function is used to return a variant variable, which contains a date value.
Now let’s look at an example. Let’s assume that I have a string value on an Excel worksheet which I want to convert to a date variable.
Dim ValueToProcess As Variant’Variable to hold the string to be processed
ValueToProcess = DateValue(ActiveSheet.Cells(1, 1).Value)
ActiveSheet.Cells(3, 1).Value = ValueToProcess
So why do we need this Excel function? The Excel DateValue is a great function to automatically convert a string for assignment to a date variable when you need it.