DateValue

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15669
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

DateValue

Post by ChrisGreaves »

DateValue.png
I found this strange: The VBA function DateValue treats an empty or a space-filled string as an error.
I had rather thought/hoped that it would return a value equal to zero.
Cheers
Chris
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.

User avatar
HansV
Administrator
Posts: 78680
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: DateValue

Post by HansV »

The VBA function DateValue doesn't work that way, as you have found.
You'll see the same behavior with the IsDate function:

IsDate("February 17") returns True
IsDate("") and IsDate(" ") return False, since VBA doesn't recognize these strings as dates.
Best wishes,
Hans