PC Review


Reply
Thread Tools Rate Thread

Change a date in text format xx.xx.20xx to a recognised date format

 
 
concatenator
Guest
Posts: n/a
 
      24th Nov 2003

I often have to deal with a column of text in the format of xx.xx.19xx.
However this is not a recognised date format.

Is there a macro or command that will allow me to select all of thes
cells and convert them into a recognised date format, eg xx/xx/19xx o
xx-jan-19xx?

At present i can split them out to columns and then concatenate th
data into a date format but this only works the cell in Row 1,not fo
the whole selection. Any suggestions? Cheer

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
 
Trevor Shuttleworth
Guest
Posts: n/a
 
      24th Nov 2003
I think the easiest way would be to select the column and do a global
replace of "." for "/".

You could record a macro as you do it ... should look something like this:

Columns("B:B").Select
Selection.Replace What:=".", Replacement:="/", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

A slightly modified version:

Columns("B:B").Replace _
What:=".", _
Replacement:="/", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False

In my testing the text was turned into dates with a date format "dd/mm/yyyy"
(which is what I expected).

Be careful if you opt for a VBA solution as dates can become "muddled" by
the USA-centricity of VBA

Regards

Trevor


"concatenator" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I often have to deal with a column of text in the format of xx.xx.19xx.
> However this is not a recognised date format.
>
> Is there a macro or command that will allow me to select all of these
> cells and convert them into a recognised date format, eg xx/xx/19xx or
> xx-jan-19xx?
>
> At present i can split them out to columns and then concatenate the
> data into a date format but this only works the cell in Row 1,not for
> the whole selection. Any suggestions? Cheers
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~View and post usenet messages directly from http://www.ExcelForum.com/
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert date (m/dd/yyyy) in text format into an excel recognised date Rob P Microsoft Excel Programming 3 30th Apr 2010 12:40 AM
Change text format to date format JLDLS Microsoft Access 2 22nd Aug 2009 02:35 AM
Change Date Format to Specific Text Format When Copying adambush4242@hotmail.com Microsoft Excel Misc 3 23rd Dec 2008 03:43 PM
change text format in one column to date format in another =?Utf-8?B?UGF1bEc=?= Microsoft Access 1 21st Oct 2004 08:06 PM
Change date format to text format Hande Microsoft Excel Programming 0 14th Nov 2003 01:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:35 AM.