Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there
Here's another I just can't understand. I am importing a CSV line by line, then using TextToColumns to delimit the data. This works fine, leaving dates in column 'A' often in the format 03-Sep-06. I perform some autofilters on that column, then copy the visible cells to another sheet using: Sheets("Working").UsedRange.Copy Destination:=Sheets("Temp").Range("A1") Somwehere along the line, Excel parses the date and results in a timeserial that corresponds to 09/12/06 - such that no matter what date formatting I use, the date will always be wrong. Having stepped through the code isolating parts, the code in question is: Columns(1).TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, FieldInfo:=Array(0, 4), TrailingMinusNumbers:=True The Array(0,4) should specify DMY format, yet it swaps the day / month as mentioned. I had inserted this line as the only means I know of to ensure that all entries in a given column are treated as dates (formatting the column won't touch string entries etc)... anyone have any useful tips regarding this action ? Any way of avoiding this for dates where the month / day are reversible ? I have Date columns with the Date values to the Left AND Right - I used the above code to convert them to Dates lying to the right... maybe this is an unnecessary step. How do you instruct Excel that all values in a column should be treated as Dates (I had assumed that if this scenario were true the values would align together on right). Pointers appreciated |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date/Time parsing and calculation | Excel Discussion (Misc queries) | |||
parsing a date field | Excel Discussion (Misc queries) | |||
parsing data - formatting issue | Excel Discussion (Misc queries) | |||
Issue with parsing text file into worksheet | Excel Programming | |||
Excel vb running a batch files and parsing output issue | Excel Programming |