Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Date formatting in VBA

I have date from text file import into excel as below
January 22, 2013 11:21 am
What I want is to convert to the date format as 22/01/13 using VBA without time. I have the code but when I try with different PC the result is different.Even I try format cell directly never work.Please help with VBA code. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Date formatting in VBA

Hi,

Am Tue, 12 Feb 2013 07:08:34 -0800 (PST) schrieb geniusideas:

I have date from text file import into excel as below
January 22, 2013 11:21 am
What I want is to convert to the date format as 22/01/13 using VBA without time. I have the code but when I try with different PC the result is different.Even I try format cell directly never work.Please help with VBA code. Thanks


your dates in column A:

Sub Test()
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("A1:A" & LRow).NumberFormat = "mmmm dd, yyyy"
Range("A1:A" & LRow).TextToColumns Destination:=Range("A1"), _
DataType:=xlFixedWidth, FieldInfo:=Array(0, 4), _
TrailingMinusNumbers:=True
Range("A1:A" & LRow).NumberFormat = "dd/mm/yy"
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
Date Formatting DaveMoore Excel Worksheet Functions 2 March 24th 10 05:41 PM
Date formatting Sandy Excel Programming 3 April 19th 08 03:33 PM
Date Colum Date Formatting & Validation Mike[_81_] Excel Programming 1 June 7th 04 01:59 AM
formatting date inquirer Excel Programming 2 December 11th 03 11:30 AM


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