Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why are some dates changing and not others?
If I were you, I would change the file extension of what you are
attempting to import from .csv to .txt (you can do this manually in Wondows Explorer or code it into VBA) and then open it using Workbooks.OpenText where you can specify how to interpret columns (see the VBA help - eg D/M/Y order etc). Richard C Flynn wrote: I have a routine that imports data from a csv file into an xls file which contains the import code. The data i'm importing contains a colunm which contains dates. "01/03/2002 00:00" (without the speech marks). for some reason when the following code opens the file, some dates have changed. for example the above date becomes "03/01/2002 00:00:00" this problem is driving me crazy because it only affects somes dates but not all so i can't change my code to reverse the month and day around. Please help. Hers the code i'm using: Sub StockP() ' Dim Target As Workbook Dim Source As Workbook Dim FName As String Dim MyPath As String MyPath = "C:\Stacker" Set Target = ThisWorkbook ChDrive MyPath ChDir MyPath FName = Dir("*.csv") If Len(FName) = 0 Then MsgBox "Stock file not found" & vbNewLine & "Try Exporting a used stock file from Pinnacle to C:\Stacker folder first" Exit Sub End If ' Application.ScreenUpdating = False If Len(FName) = 90 Then Workbooks.Open Filename:=FName etc -- C Flynn UK |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing dates | Excel Discussion (Misc queries) | |||
Stop UK-style dates changing to US-style dates when mailmerging. | Excel Discussion (Misc queries) | |||
changing dates. | Excel Worksheet Functions | |||
Changing Dates | Excel Programming | |||
Changing Dates | Excel Discussion (Misc queries) |