Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default date format conversion

I have date data entered in a cell as general format like 24/12/07 (in
general format left side aligned)

I have to change this date to date format. How to change this through macro?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default date format conversion

You could convert the date by inserting a helper column to the right of the
date column and enter the following formula (assuming the first date is in
cell A1):

=DATE(RIGHT(A1,2)+2000,MID(A1,4,2),LEFT(A1,2))

Copy down the column as far as necessary, copy the entire contents of the
formula column and then do a EDIT/PASTE SPECIAL and paste the formula results
over the original date column.

Delete the heplper column when done.
--
Kevin Backmann


"ezil" wrote:

I have date data entered in a cell as general format like 24/12/07 (in
general format left side aligned)

I have to change this date to date format. How to change this through macro?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default date format conversion

Assuming the data is in a1 and you're converting into b1:

With Range("b1")
.FormulaR1C1 = _
"=VALUE(CONCATENATE(MID(RC[-1],4,2),""/"",LEFT(RC[-1],
2),""/"",RIGHT(RC[-1],1)))"
.NumberFormat = "mm/dd/yy;@"
End With

Cliff Edwards
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
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
TEXT DATE Format Conversion Ashish_Vaidya Excel Programming 1 February 13th 07 10:52 PM
Conversion of date into different format Fam via OfficeKB.com Excel Discussion (Misc queries) 8 July 31st 06 09:14 PM
Date format conversion Terry Pinnell Excel Discussion (Misc queries) 5 November 21st 05 07:53 PM
Date Format - Conversion tinkertoy Excel Discussion (Misc queries) 1 July 14th 05 06:24 PM


All times are GMT +1. The time now is 09:26 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"