Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change a date in text format xx.xx.20xx to a recognised date format


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Change a date in text format xx.xx.20xx to a recognised date format

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" wrote in message
...

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
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
change date format dd/mm/yyyy to Julian date format? itzy bitzy Excel Worksheet Functions 1 December 8th 09 07:42 PM
Change Date Format to Specific Text Format When Copying [email protected] Excel Discussion (Misc queries) 4 December 23rd 08 03:43 PM
how do i change text format date to date (i.e., mm/yy to mm/dd/yyy lindsey Excel Discussion (Misc queries) 1 July 27th 07 10:05 PM
CHANGE TEXT TO DATE FORMAT deniseh Excel Discussion (Misc queries) 2 September 15th 05 12:48 PM
Change date format to text format Hande Excel Programming 0 November 14th 03 01:37 PM


All times are GMT +1. The time now is 06:19 PM.

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"