Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Format Issue
I have a file that exports a date in the following format:
2003.12.30 2004.5.11 Its the year, month and then day. BUt I cannot use cell formating t change the date format to: Month/Day/Year How can I do this using programming. The data is always in column -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Format Issue
Alex,
Try something like the following: Sub AAA() Dim Y As Integer Dim M As Integer Dim D As Integer Dim Rng As Range Dim Arr As Variant For Each Rng In Range("D1:D10") '<<<CHANGE If Rng.Value < "" Then Arr = Split(Rng.Text, ".") Y = Arr(LBound(Arr)) M = Arr(LBound(Arr) + 1) D = Arr(LBound(Arr) + 2) Rng.Value = DateSerial(Y, M, D) End If Next Rng End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "alexm999 " wrote in message ... I have a file that exports a date in the following format: 2003.12.30 2004.5.11 Its the year, month and then day. BUt I cannot use cell formating to change the date format to: Month/Day/Year How can I do this using programming. The data is always in column D --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please help....Date Format issue | Excel Discussion (Misc queries) | |||
date format issue | Excel Discussion (Misc queries) | |||
DATE FORMAT issue | Excel Worksheet Functions | |||
Date format issue | Excel Worksheet Functions | |||
Another Date Format issue | Excel Programming |