View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default convert a text date to a true date

We normally enter dates here as day first followed by month and then
year, so 3 March or 3 March 2007 are recognised, but March 3 2007 or
March 3, 2007 are not, and are treated as strings.


I knew you guys wrote your dates backwards<g, but VB/VBA will still
interpret them as dates here. Likewise, if you go into the VBA editor and
type/enter this...

Print IsDate("March 3, 2007")

in the Immediate window, it will print True just like if I type/enter
this...

Print IsDate("3 March 2007")

here, it too will print True. VB/VBA will accept anything that is considered
a date anywhere in the world as a date in any locale (within Date functions,
of course). I just figured the same date engine was at work within the Excel
spreadsheet world as well.

So, you learn something new every day <bg


Yep... I did with this thread. Thanks again for pointing it out to me.

Rick