Hello everybody here at PHD.
I'm a bit stuck with Date format while importing CSV files, and / or copying the data.
Here's what I try to do.
Consider 2 bug defect systems capable to export to CSV (tab separated). The structure of the data is like this :
System 1 :
My firts idea is to import into separate sheets each CSV file. This seems to work with the following VBA code :
[pre]<br />
Set tempWkb = Workbooks.Open(ActiveWorkbook.Path & "workmyFile.xls"<br />
Range("A1", Selection.End(xlToRight)).Select<br />
Range(Selection, Selection.End(xlDown)).Select<br />
Selection.Copy Destination:=mySheet.Range("A1"<br />
tempWkb.Close SaveChanges:=False<br />[/code][/pre]
I've tried to use QueryTables.Add but the "description" field is totally imported, causing glitches in columns (special characters are badly handled).
Now I'm copying each line of each sheet trying to aggregate the data when they match (special rule in the title of system2).
The date column is now strange (French formatting in the first 2 lines / US after):
16/07/2009 15:11:00
15/07/2009 15:10:33
07/10/2009 16:30
07/09/2009 18:59
When the day if less than 12 I've the second ones, the first format otherwise. The VBA Code (copying the date) is the following :
Sys1Sheet.Cells(Sys1_CurLine, 1).Range(Sys1_Range_Relative).Copy Destination:=Out.Cells(Out_Cur, Sys1_Start_Index).Range("A1"[/code]
My questions are :
1. Is there anyway to tell the format while copying without affecting each cells (perf issue) ?
2. Can I use/tell QueryTables.Add to import only the first xxx characters of a long string ?
3. Can I affect an array formula form one cell in VBA ? (to avoid the copy and thus retrieving the correct format)
Thanks in advance.
Cyril Z.
[EDIT] : If someone has a better idea... This forum seems a great idea anywya.
I'm a bit stuck with Date format while importing CSV files, and / or copying the data.
Here's what I try to do.
Consider 2 bug defect systems capable to export to CSV (tab separated). The structure of the data is like this :
System 1 :
Code:
Bug ID1 / Author / Date / Priority 1 / Title (short) / Description (can be very long and contains special character) / Project Code
System 2 :
[code]Bug ID2 / Title (with special formatting sometimes)/ Solving status
I want to build a sheet containing the following entries :
[code]Bug ID1 / Bug ID2 / Date / Priority / Project Code / Solving Status / Title / Description
My firts idea is to import into separate sheets each CSV file. This seems to work with the following VBA code :
[pre]<br />
Set tempWkb = Workbooks.Open(ActiveWorkbook.Path & "workmyFile.xls"<br />
Range("A1", Selection.End(xlToRight)).Select<br />
Range(Selection, Selection.End(xlDown)).Select<br />
Selection.Copy Destination:=mySheet.Range("A1"<br />
tempWkb.Close SaveChanges:=False<br />[/code][/pre]
I've tried to use QueryTables.Add but the "description" field is totally imported, causing glitches in columns (special characters are badly handled).
Now I'm copying each line of each sheet trying to aggregate the data when they match (special rule in the title of system2).
The date column is now strange (French formatting in the first 2 lines / US after):
16/07/2009 15:11:00
15/07/2009 15:10:33
07/10/2009 16:30
07/09/2009 18:59
When the day if less than 12 I've the second ones, the first format otherwise. The VBA Code (copying the date) is the following :
Sys1Sheet.Cells(Sys1_CurLine, 1).Range(Sys1_Range_Relative).Copy Destination:=Out.Cells(Out_Cur, Sys1_Start_Index).Range("A1"[/code]
My questions are :
1. Is there anyway to tell the format while copying without affecting each cells (perf issue) ?
2. Can I use/tell QueryTables.Add to import only the first xxx characters of a long string ?
3. Can I affect an array formula form one cell in VBA ? (to avoid the copy and thus retrieving the correct format)
Thanks in advance.
Cyril Z.
[EDIT] : If someone has a better idea... This forum seems a great idea anywya.