wallstudio
New Member
- Joined
- Oct 19, 2010
- Messages
- 36
I need VBA to copy rows from one of thousands of csv files in the same directory. The file name structure of csv is "(000#)_ABCD.csv", where number inside bracket is 4 digits, and the "ABCD" is the name code.
There are 6 columns in each csv, with ascending date in column A.
In my WB, A1 is date, B1 is the number code of csv file. However, the format is regular number showing "1" instead of "0001".
The VBA need to refer to the number in B1 and open the csv file from the directory. Then copy a year range of data from the csv and paste to the WB starting from A3 with A1 value as the latest date. That means, if A1 is 1/1/2011, the date range to be copied should be 1/1/2010 to 1/1/2011. Then, the csv need to be closed also.
Thanks for the help.
There are 6 columns in each csv, with ascending date in column A.
In my WB, A1 is date, B1 is the number code of csv file. However, the format is regular number showing "1" instead of "0001".
The VBA need to refer to the number in B1 and open the csv file from the directory. Then copy a year range of data from the csv and paste to the WB starting from A3 with A1 value as the latest date. That means, if A1 is 1/1/2011, the date range to be copied should be 1/1/2010 to 1/1/2011. Then, the csv need to be closed also.
Thanks for the help.