A
Ayato
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
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