Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KDJ KDJ is offline
external usenet poster
 
Posts: 19
Default Reformatting incorrect dates

Hello
I have basic VBA knowledge and am trying to solve the following problem In
Excel 2003:

I receive a database with a date column containing data gathered from 2
databases. The date is formatted in two different ways:

'15/07/2005
15.07.2005

I would like to change all dates formatted as character to "real" dates
which is the second option above (European format with dots).

I have tried recording the following:

' In Date column, replace / with .
Columns("A:A").Select
Selection.Replace What:="/", Replacement:="."

' Change date text to number
Range("N1").Select
ActiveCell.FormulaR1C1 = "1"
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

It works manually but not when replayed as a macro. The dates (even those
that were originally) correct turn into characters ... if I use Edit / Clear
/ Formats none of the dates revert to numbers.

I really appreciate your help!

Thanks very much. KDJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Reformatting incorrect dates

Hi KDJ,

With the dates selected,

Data | Text to Columns | Delimited | Next | Next | Check the Date option
button | Select a date sequence from the dropdown | Finish

This should convert the text values to date in your local settings format.

---
Regards,
Norman



"KDJ" wrote in message
...
Hello
I have basic VBA knowledge and am trying to solve the following problem In
Excel 2003:

I receive a database with a date column containing data gathered from 2
databases. The date is formatted in two different ways:

'15/07/2005
15.07.2005

I would like to change all dates formatted as character to "real" dates
which is the second option above (European format with dots).

I have tried recording the following:

' In Date column, replace / with .
Columns("A:A").Select
Selection.Replace What:="/", Replacement:="."

' Change date text to number
Range("N1").Select
ActiveCell.FormulaR1C1 = "1"
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

It works manually but not when replayed as a macro. The dates (even those
that were originally) correct turn into characters ... if I use Edit /
Clear
/ Formats none of the dates revert to numbers.

I really appreciate your help!

Thanks very much. KDJ



  #3   Report Post  
Posted to microsoft.public.excel.programming
KDJ KDJ is offline
external usenet poster
 
Posts: 19
Default Reformatting incorrect dates

Thanks!! Much easier solution. Just tested it and it works beautifully.
Thanks
KDJ

"Norman Jones" schrieb:

Hi KDJ,

With the dates selected,

Data | Text to Columns | Delimited | Next | Next | Check the Date option
button | Select a date sequence from the dropdown | Finish

This should convert the text values to date in your local settings format.

---
Regards,
Norman



"KDJ" wrote in message
...
Hello
I have basic VBA knowledge and am trying to solve the following problem In
Excel 2003:

I receive a database with a date column containing data gathered from 2
databases. The date is formatted in two different ways:

'15/07/2005
15.07.2005

I would like to change all dates formatted as character to "real" dates
which is the second option above (European format with dots).

I have tried recording the following:

' In Date column, replace / with .
Columns("A:A").Select
Selection.Replace What:="/", Replacement:="."

' Change date text to number
Range("N1").Select
ActiveCell.FormulaR1C1 = "1"
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

It works manually but not when replayed as a macro. The dates (even those
that were originally) correct turn into characters ... if I use Edit /
Clear
/ Formats none of the dates revert to numbers.

I really appreciate your help!

Thanks very much. KDJ




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
Reformatting ILoveMyCorgi Excel Discussion (Misc queries) 5 January 12th 10 06:42 AM
Dates Incorrect in Chart Jim Charts and Charting in Excel 5 October 11th 08 03:15 PM
reformatting dates [email protected] Excel Discussion (Misc queries) 6 July 12th 07 09:09 PM
Reformatting dates for sorting MEAD5432 Excel Discussion (Misc queries) 2 June 2nd 07 12:41 AM
Reformatting dates as text AmyTaylor Excel Worksheet Functions 1 November 11th 05 11:25 AM


All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"