Y
Yarroll
Hello List!
Is there an easy way to perform the following task?
I have 2 folders on Pulpit. One, "Source", contains CSV files. Second
("Target") holds corresponding Excel Files (XLS). XLS filenames are
identical as CSV (except file extension). Is it possible to pump CSVs into
XLS by some simple macro?
I've been doing in by the following macro:
Dim MyVal As String
MyVal = InputBox("Whereto this time?")
ChDir "c:\windows\pulpit\source"
Workbooks.Open Filename:="c:\windows\pulpit\source\abracadabra01.csv"
Cells.Copy
Workbooks.Open Filename:="c:\windows\pulpit\target\abracadabra01.xls"
Sheets(MyVal).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
ActiveWorkbook.Close
and so on, next CSV-XLS pair. It's OK, only before every such operation I
have to make a new macro to input filenames ("abracadabra", "zebra", etc
etc)
1) first in DOS, dir>list.txt
2) list.txt into Word which adds/replaces etc appropriate lines in this
macro
3) finally macro into Excel.
This seems to be quite a drag, so I'm looking for a macro along this idea:
dim XXX as filename
for each CSV in c:\windows\pulpit\source if there is an XLS counterpart in
c:\windows\pulpit\target, then copy XXX cells into this XLS into a
user-specified (prompt!) worksheet.
I hope I'm making myself clear :-((
Thanks. Best regards
Yarroll
Is there an easy way to perform the following task?
I have 2 folders on Pulpit. One, "Source", contains CSV files. Second
("Target") holds corresponding Excel Files (XLS). XLS filenames are
identical as CSV (except file extension). Is it possible to pump CSVs into
XLS by some simple macro?
I've been doing in by the following macro:
Dim MyVal As String
MyVal = InputBox("Whereto this time?")
ChDir "c:\windows\pulpit\source"
Workbooks.Open Filename:="c:\windows\pulpit\source\abracadabra01.csv"
Cells.Copy
Workbooks.Open Filename:="c:\windows\pulpit\target\abracadabra01.xls"
Sheets(MyVal).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
ActiveWorkbook.Close
and so on, next CSV-XLS pair. It's OK, only before every such operation I
have to make a new macro to input filenames ("abracadabra", "zebra", etc
etc)
1) first in DOS, dir>list.txt
2) list.txt into Word which adds/replaces etc appropriate lines in this
macro
3) finally macro into Excel.
This seems to be quite a drag, so I'm looking for a macro along this idea:
dim XXX as filename
for each CSV in c:\windows\pulpit\source if there is an XLS counterpart in
c:\windows\pulpit\target, then copy XXX cells into this XLS into a
user-specified (prompt!) worksheet.
I hope I'm making myself clear :-((
Thanks. Best regards
Yarroll