Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
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
Please help....Date Format issue SandyW Excel Discussion (Misc queries) 1 January 7th 09 07:29 PM
date format issue Arjen Excel Discussion (Misc queries) 3 August 22nd 06 02:04 PM
DATE FORMAT issue [email protected] Excel Worksheet Functions 1 February 8th 06 07:52 AM
Date format issue LadyDoe Excel Worksheet Functions 1 November 17th 05 07:54 AM
Another Date Format issue Wayne Nelson Excel Programming 1 December 4th 03 06:27 AM


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