LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Converting dates


It even works when the input date string has hyphens, such as:

"1-3-2019" ' This gets converted to "01/03/19"

"1-3" ' This also gets converted to "01/03/19"


I forgot to ask, how can I test if the input string does NOT resemble a date
string (or even a date string with hyphens like above)?


This is why I suggested you play with the Date NumberFormats AFTER running the
code! If you start with a clean sheet and select A1:D3 as a group, then run the
code, THEN try different date formats for the selection.

Note that the left-aligned content is text AND the right-aligned content is a
date. Observe the FormulaBar contents while navigating the selection via the
Enter key to see the actual cell values versus what displays.

As you can see, hyphens are a built-in format in dates and so is interpreted
correctly; - the only other character that is correctly interpreted is the
forward slash.

Let your curiosity run wild and enjoy the exercise!!<g

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Julian Dates to regular dates CDTucson Excel Worksheet Functions 2 June 7th 07 04:20 AM
Converting Dates Jacq Excel Worksheet Functions 5 March 5th 07 11:10 PM
Converting Text dates into dates EAB1977 Excel Programming 2 January 20th 06 04:20 PM
Converting Dates jer101[_9_] Excel Programming 8 June 25th 04 01:01 AM
converting dates mike Excel Programming 2 February 19th 04 11:31 PM


All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"