Problem with date formatting
Posted by Dave on September 25, 2000 6:42 AM
I am trying to record a macro, part of which changes a column of dates from standard English format (dd/mm/yy) to yyyymmdd, after having converted the year part from 0000 to 2000. It runs on a .csv file.
When I carry this out manually, it works fine, but when I record it in a macro, it does not properly change the format. Each cell is still dd/mm/yy, but if I double click the cell, then move to another, it appears correctly as yyyymmdd. The properties for the whole column say yyyymmdd
The macro goes on to save the file, and when re-opened, the format is "general" and still appears dd/mm/yy.
The whole procedure works fine while I'm recording it. But running the same macro throws up this problem.
The generated code is as follows:
Selection.Replace What:="/0000", Replacement:="/2000", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
Selection.NumberFormat = "yyyymmdd"
Any ideas? Thanks.