![]() |
Import of multiple .CSV files into Excel
Hi @ll,
I need to build a macro to import data from all .csv files located in specific directory into an Excel file (on the same sheet)... I have manage to build a single extract (with 1 file) but I need to b able to loop threw all files, extract the data, copy and paste and th bottom of the sheet... Here is the code of the macro for the single extract : Sub Macro1() With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\Test\test.csv", _ Destination:=Range("A1")) .Name = "test" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = xlWindows .TextFileStartRow = 4 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = False .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1) .Refresh BackgroundQuery:=False End With End Sub Please advise, Thx Ayat -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 12:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com