[Help!] CSV(s) --> xls

  • Thread starter Thread starter Catherine
  • Start date Start date
C

Catherine

Hi all,

I'm new to the world of excel programming. Please help me, as this
problem bothers me for quite a long time.

I have many .csv files (generated by programmes), all I want to do is
comparing those files and do some analysis (eg. charting). How can I
automate the whole process?

Eg. I have to .csv files.
A.csv and B.csv (they can be as simple as a name and a value to compare,
eg. SALARY, 60). How can I:
1. create a AB.xls file contain these two worksheets
2. plot a chart for comparison in a new worksheet in the same AB.xls
file. (eg. BAR chart to compare SALARY of A & B)

How can they be achived (programs, scripts, etc) by not manually?!

Thanks!!!
 
set wb1 = workbooks.open "C:\CSV\a.csv"
set wb2 = workbooks.open "C:\CSV\b.csv"
wb1.worksheets(1).Columns(1).Resize(2).copy _
Destination:=wb1.worksheets(1).Range("D1")
wkb2.close savechanges=false

wb1.SaveAs filename:="C:\Archive\ab.xls", fileformat:=xlWorkbookNormal

' code to do the comparison - the term compare is not self defining.
' may include a sort of A:B then sort of D:E assumes all names will
' match, then

set rng = Range(Cells(1,1),Cells(rows.count,1).End(xlup))
rng.offset(0,6).Formula = "=A1"
rng.offset(0,7).Formula = "=E1-B1"
' this gives a difference column as an example

' code to do plot (should be able to get with the macro recorder)

wb1.Save
wb2.Close SaveChanges:=False

--
Regards,
Tom Ogilvy

Hi all,

I'm new to the world of excel programming. Please help me, as this problem
bothers me for quite a long time.

I have many .csv files (generated by programmes), all I want to do is
comparing those files and do some analysis (eg. charting). How can I
automate the whole process?

Eg. I have to .csv files.
A.csv and B.csv (they can be as simple as a name and a value to compare, eg.
SALARY, 60). How can I:
1. create a AB.xls file contain these two worksheets
2. plot a chart for comparison in a new worksheet in the same AB.xls file.
(eg. BAR chart to compare SALARY of A & B)

How can they be achived (programs, scripts, etc) by not manually?!

Thanks!!!
 
Back
Top