Using Excel 2000</SPAN></SPAN>
Hi,</SPAN></SPAN>
I have created one folder on desktop and named "csvfiles" when I receive a new file I just add into this folder (in the same folder I have put one excel workbook named "csvfilestoexcel" </SPAN></SPAN>
I want I code when I open "csvfilestoexcel" and run the macro it list all the files are in to the folder "csvfilestoexcel" in the sheet1 into the column A and then all "csvfiles" are listed in the sheet1 import them one by one in the sheet "Imported"</SPAN></SPAN>
Is it possible?</SPAN></SPAN>
This is code I have recorded and imported 2 columns data from 2 files a1 & a2 and paste them transpose in to sheet "Imported" need a code which can do import all files automatically </SPAN></SPAN>
</SPAN></SPAN>
Example of imported files</SPAN></SPAN>
Thank you in advance</SPAN></SPAN>
Regards,</SPAN>
Kishan</SPAN>
Hi,</SPAN></SPAN>
I have created one folder on desktop and named "csvfiles" when I receive a new file I just add into this folder (in the same folder I have put one excel workbook named "csvfilestoexcel" </SPAN></SPAN>
I want I code when I open "csvfilestoexcel" and run the macro it list all the files are in to the folder "csvfilestoexcel" in the sheet1 into the column A and then all "csvfiles" are listed in the sheet1 import them one by one in the sheet "Imported"</SPAN></SPAN>
Is it possible?</SPAN></SPAN>
This is code I have recorded and imported 2 columns data from 2 files a1 & a2 and paste them transpose in to sheet "Imported" need a code which can do import all files automatically </SPAN></SPAN>
Code:
Sub Import_Csvfiles()
Sheets("Imported").Select
ChDir "D:\Desktop\csvfiles"
Workbooks.Open Filename:="D:\Desktop\csvfiles\a1.csv"
Range("C1:C14").Select
Selection.Copy
Windows("csvfilestoexcel.xls").Activate
Range("D10").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Range("S10").Select
Windows("a1.csv").Activate
Range("D1:D14").Select
Application.CutCopyMode = False
Selection.Copy
Windows("csvfilestoexcel.xls").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Range("D11").Select
Windows("a1.csv").Activate
ActiveWindow.Close
Workbooks.Open Filename:="D:\Desktop\csvfiles\a2.csv"
Range("C1:C14").Select
Selection.Copy
Windows("csvfilestoexcel.xls").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Range("S11").Select
Windows("a2.csv").Activate
Range("D1:D14").Select
Application.CutCopyMode = False
Selection.Copy
Windows("csvfilestoexcel.xls").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Range("D9").Select
Windows("a2.csv").Activate
ActiveWindow.Close
ActiveWorkbook.Save
End Sub
Example of imported files</SPAN></SPAN>
Book1 | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | AE | AF | AG | AH | |||
1 | ||||||||||||||||||||||||||||||||||||
2 | ||||||||||||||||||||||||||||||||||||
3 | ||||||||||||||||||||||||||||||||||||
4 | ||||||||||||||||||||||||||||||||||||
5 | ||||||||||||||||||||||||||||||||||||
6 | ||||||||||||||||||||||||||||||||||||
7 | ||||||||||||||||||||||||||||||||||||
8 | ||||||||||||||||||||||||||||||||||||
9 | ||||||||||||||||||||||||||||||||||||
10 | 46,3 | 46,8 | 90 | 56,6 | 26,6 | 30,9 | 55,3 | 31,8 | 37,1 | 43 | 59,6 | 43,8 | 57,5 | 65,4 | 28,9 | 28,4 | 7,44 | 25,5 | 25,8 | 30,2 | 27,1 | 32,9 | 32,3 | 31,5 | 26,5 | 29,7 | 27,8 | 24,1 | ||||||||
11 | 32,5 | 4,46 | 30,7 | 55,2 | 10,4 | 38,2 | 59,1 | 28,7 | 40,4 | 58,3 | 35,1 | 60,1 | 53,5 | 30,6 | 29 | 10,8 | 29,2 | 24,4 | 17,7 | 29,2 | 25,5 | 32,9 | 33,2 | 27 | 31,3 | 27,4 | 27 | 32,2 | ||||||||
12 | ||||||||||||||||||||||||||||||||||||
13 | ||||||||||||||||||||||||||||||||||||
14 | ||||||||||||||||||||||||||||||||||||
Imported |
Thank you in advance</SPAN></SPAN>
Regards,</SPAN>
Kishan</SPAN>